module JavaCalendar: sig .. end
Utility functions for Java calendars.
Instance creation
Fields
type am_pm =
Whether the hour is before or after noon.
type month =
| |
January |
| |
February |
| |
March |
| |
April |
| |
May |
| |
June |
| |
July |
| |
August |
| |
September |
| |
October |
| |
November |
| |
December |
| |
Undecimber |
The different month values.
type day =
| |
Monday |
| |
Tuesday |
| |
Wednesday |
| |
Thursday |
| |
Friday |
| |
Saturday |
| |
Sunday |
The different day values.
type '_ field =
The different fields of a calendar.
Properties
val get_time : t -> java_long
get_time cal
returns the time of the passed calendar, as the number
of milliseconds since
1970-01-01 00:00:00; see
getTimeInMillis(...).
val after : t -> t -> bool
after cal when
returns
true
iff
cal
is strictly later than
when
; see
after(...).
val before : t -> t -> bool
before cal when
returns
true
iff
cal
is strictly later than
when
; see
before(...).
val compare_to : t -> t -> int
val get : t -> 'a field -> 'a
get cal f
returns the value for field
f
in calendar
cal
; see
get(...).
Creation of new calendar values
val add : t -> 'a field -> java_int -> t
add cal f delta
returns a new instance that is equal to
cal
, with
the field
f
modified by adding
delta
; see
add(...).
val set : t -> 'a field -> 'a -> t
set cal f v
returns a new instance that is equal to
cal
, with
the field
f
changed to
v
; see
set(...).
val clear : t -> 'a field -> t
clear cal f
returns a new instance that is equal to
cal
, with
the field
f
cleared; see
clear(...).
val clear_all : t -> t
clear_all cal
returns a new instance that is equal to
cal
, with
the all fields cleared; see
clear(...).
val set_time_zone : t -> JavaTimeZone.t -> t
set_time_zone cal tz
returns a new instance that is equal to
cal
,
with the time zone set to
tz
; see
setTimeZone(...).
Conversions
val to_date : t -> JavaDate.t
Converts the passed calendar into a date.
val of_date : JavaDate.t -> t
Converts the passed date into a calendar.
val to_iso8601 : t -> JavaString.t
Converts the passed calendar into a string.
val of_iso8601 : JavaString.t -> t
Converts the passed string into a calendar.
Raises Java_exception
if the passed string does not conform to the
ISO8601 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
.