module JavaDate: sig .. end
Utility functions for Java dates.
Instance creation
val make : java_long -> t
Returns a new
java.util.Date instance for the passed time,
as the number of milliseconds since
1970-01-01 00:00:00.
Properties
val get_time : t -> java_long
get_time date
returns the time of the passed date, as the number of
milliseconds since
1970-01-01 00:00:00; see
getTime(...).
val after : t -> t -> bool
after date when
returns
true
iff
date
is strictly later than
when
; see
after(...).
val before : t -> t -> bool
before date when
returns
true
iff
date
is strictly earlier than
when
; see
before(...).
val compare_to : t -> t -> int
Conversions
type format_style =
| |
Full |
| |
Long |
| |
Medium |
| |
Short |
The type of format styles.
val make_simple_format : ?pattern:JavaString.t ->
?locale:JavaLocale.t -> ?time_zone:JavaTimeZone.t -> unit -> format
Creates a format from the passed pattern, locale, and time zone. The
locale is actually used iff the pattern is not
null
. The pattern
format is described in the javadoc for
java.text.SimpleDateFormat.
Raises Java_exception
if the pattern is invalid
val of_string : format -> JavaString.t -> t
Converts the passed string into a date.
Raises Java_exception
if the string does not conform to the format
Null value
val null : t
The null
value.
val is_null : t -> bool
is_null obj
returns true
iff obj
is equal to null
.
val is_not_null : t -> bool
is_not_null obj
returns false
iff obj
is equal to null
.
Miscellaneous
val wrap : t -> t option
wrap obj
wraps the reference
obj
into an option type:
Some x
if obj
is not null
;
None
if obj
is null
.
val unwrap : t option -> t
unwrap obj
unwraps the option
obj
into a bare reference:
Some x
is mapped to x
;
None
is mapped to null
.