Module DateTime

module DateTime: sig .. end

Relative offset of the timezone to UTC


type _TZrel 
type _timezone 

Internal Representation of a timezone

type xs_time 

xs:time datatype

type xs_date 

xs:date datatypes

type xs_dateTime 

xs:dateTime datatype consisting of a date value and a time value

type xs_duration 

xs:duration datatype consisting of a year,month,day,hour,minute, and second

type xs_gYearMonth 

xs:gYearMonth datatype consisting of a year value and a month value

type xs_gYear 

xs:gYear datatype consisting of a year value

type xs_gMonthDay 

xs:gMonthDay datatype consisting of a month value and a day value

type xs_gDay 

xs:gDay datatype consisting of a day value

type xs_gMonth 

xs:gMonth datatype consisting of a month value

type xs_yearMonthDuration 

xs:yearMonthDuration datatype

type xs_dayTimeDuration 

xs:dayTimeDuration datatype

string_of_ functions

val string_of_date : xs_date -> string

Gives the string value of an xs_date

val string_of_duration : xs_duration -> string
val string_of_gYearMonth : xs_gYearMonth -> string
val string_of_gYear : xs_gYear -> string
val string_of_gMonthDay : xs_gMonthDay -> string
val string_of_gDay : xs_gDay -> string
val string_of_gMonth : xs_gMonth -> string
val string_of_time : xs_time -> string

Gives the string value of an xs_time

val string_of_dateTime : xs_dateTime -> string

Gives the string value of an xs_dateTime

val string_of_yearMonthDuration : xs_yearMonthDuration -> string

Gives the string representation of a yearMonthDuration

val canonical_of_yearMonthDuration : xs_yearMonthDuration -> string
val string_of_dayTimeDuration : xs_dayTimeDuration -> string

Gives the string representation of a dayTimeDuration

val canonical_of_dayTimeDuration : xs_dayTimeDuration -> string

Constructors for the date/time datatypes

val mkdate : int option * int * int * xs_dayTimeDuration option ->
xs_date

Takes a year, month, day, and timezone as a duration and returns an xs_date datatype.

val mktime : int * int * Decimal._decimal * xs_dayTimeDuration option ->
xs_time

Takes an hour, minute, second and timezone as a duration and returns an xs_time datatype.

Takes an hour, minute, second and timezone as a duration and returns an xs_time datatype.

val mktime_dtd : int * int * Decimal._decimal * xs_dayTimeDuration option ->
xs_dayTimeDuration * xs_time
val mkdateTime : xs_date * xs_time * xs_dayTimeDuration option ->
xs_dateTime

Takes a date, a time, and a timezone as a duration and returns an xs_dateTime

val mkgYearMonth : int * int * xs_dayTimeDuration option -> xs_gYearMonth
val mkgYear : int * xs_dayTimeDuration option -> xs_gYear
val mkgMonthDay : int * int * xs_dayTimeDuration option -> xs_gMonthDay
val mkgDay : int * xs_dayTimeDuration option -> xs_gDay
val mkgMonth : int * xs_dayTimeDuration option -> xs_gMonth
val mkyearMonthDuration : int * int -> xs_yearMonthDuration

Takes a number of years and a number of months and returns a yearMonthDuration

val zero_yearMonthDuration : xs_yearMonthDuration
val mkdayTimeDuration : int * int * int * Decimal._decimal -> xs_dayTimeDuration

Takes a number of days, hours, minutes, and seconds and returns a dayTimeDuration

val zero_dayTimeDuration : xs_dayTimeDuration
val mkduration : bool ->
xs_yearMonthDuration * xs_dayTimeDuration ->
xs_duration

Operations Comparisons and Arithmetic operations

val date_compare : xs_dayTimeDuration option ->
xs_date -> xs_date -> int

Compares two dates. The dayTimeDuration option is the timezone used if one of the dates does not contain a timezone.

val duration_compare : xs_duration -> xs_duration -> int
val gYearMonth_compare : xs_dayTimeDuration option ->
xs_gYearMonth -> xs_gYearMonth -> int
val gYear_compare : xs_dayTimeDuration option ->
xs_gYear -> xs_gYear -> int
val gMonthDay_compare : xs_dayTimeDuration option ->
xs_gMonthDay -> xs_gMonthDay -> int
val gDay_compare : xs_dayTimeDuration option ->
xs_gDay -> xs_gDay -> int
val gMonth_compare : xs_dayTimeDuration option ->
xs_gMonth -> xs_gMonth -> int
val add_yearMonthDuration_to_date : xs_date -> xs_yearMonthDuration -> xs_date

Add a yearMonthDuration to a date yielding the new date

val add_dayTimeDuration_to_date : xs_date -> xs_dayTimeDuration -> xs_date
val subtract_dates : xs_date -> xs_date -> xs_dayTimeDuration
val subtract_yearMonthDuration_from_date : xs_date -> xs_yearMonthDuration -> xs_date
val subtract_dayTimeDuration_from_date : xs_date -> xs_dayTimeDuration -> xs_date
val time_compare : xs_dayTimeDuration option ->
xs_time -> xs_time -> int
val add_dayTimeDuration_to_time : xs_time -> xs_dayTimeDuration -> xs_time
val subtract_dateTimes : xs_dateTime -> xs_dateTime -> xs_dayTimeDuration
val subtract_dates : xs_date -> xs_date -> xs_dayTimeDuration
val subtract_times : xs_time -> xs_time -> xs_dayTimeDuration
val subtract_dayTimeDuration_from_time : xs_time -> xs_dayTimeDuration -> xs_time
val dateTime_compare : xs_dayTimeDuration option ->
xs_dateTime -> xs_dateTime -> int
val add_yearMonthDuration_to_dateTime : xs_dateTime -> xs_yearMonthDuration -> xs_dateTime
val add_yearMonthDuration_to_dateTime2 : xs_yearMonthDuration -> xs_dateTime -> xs_dateTime
val add_dayTimeDuration_to_dateTime : xs_dateTime -> xs_dayTimeDuration -> xs_dateTime
val subtract_dateTimes : xs_dateTime -> xs_dateTime -> xs_dayTimeDuration
val subtract_yearMonthDuration_from_dateTime : xs_dateTime -> xs_yearMonthDuration -> xs_dateTime
val subtract_dayTimeDuration_from_dateTime : xs_dateTime -> xs_dayTimeDuration -> xs_dateTime
val dateTime_from_date_and_time : xs_date -> xs_time -> xs_dateTime
val yearMonthDuration_compare : xs_yearMonthDuration -> xs_yearMonthDuration -> int
val add_yearMonthDurations : xs_yearMonthDuration ->
xs_yearMonthDuration -> xs_yearMonthDuration
val subtract_yearMonthDurations : xs_yearMonthDuration ->
xs_yearMonthDuration -> xs_yearMonthDuration
val multiply_yearMonthDuration : xs_yearMonthDuration -> float -> xs_yearMonthDuration
val multiply_yearMonthDuration2 : float -> xs_yearMonthDuration -> xs_yearMonthDuration
val divide_yearMonthDuration : xs_yearMonthDuration -> float -> xs_yearMonthDuration
val divide_yearMonthDuration_by_yearMonthDuration : xs_yearMonthDuration ->
xs_yearMonthDuration -> Decimal._decimal
val dayTimeDuration_compare : xs_dayTimeDuration -> xs_dayTimeDuration -> int
val add_dayTimeDurations : xs_dayTimeDuration ->
xs_dayTimeDuration -> xs_dayTimeDuration
val subtract_dayTimeDurations : xs_dayTimeDuration ->
xs_dayTimeDuration -> xs_dayTimeDuration
val multiply_dayTimeDuration : xs_dayTimeDuration -> float -> xs_dayTimeDuration
val multiply_dayTimeDuration2 : float -> xs_dayTimeDuration -> xs_dayTimeDuration
val divide_dayTimeDuration : xs_dayTimeDuration -> float -> xs_dayTimeDuration
val divide_dayTimeDuration_by_dayTimeDuration : xs_dayTimeDuration ->
xs_dayTimeDuration -> Decimal._decimal

Extraction functions on dates, times, and durations

val years_from_duration : xs_yearMonthDuration -> int
val months_from_duration : xs_yearMonthDuration -> int
val days_from_duration : xs_dayTimeDuration -> int
val hours_from_duration : xs_dayTimeDuration -> int
val minutes_from_duration : xs_dayTimeDuration -> int
val seconds_from_duration : xs_dayTimeDuration -> Decimal._decimal
val hours_from_time : xs_time -> int
val minutes_from_time : xs_time -> int
val seconds_from_time : xs_time -> Decimal._decimal
val timezone_from_time : xs_time -> xs_dayTimeDuration
val opt_timezone_from_time : xs_time -> xs_dayTimeDuration option
val year_from_date : xs_date -> int
val month_from_date : xs_date -> int
val day_from_date : xs_date -> int
val timezone_from_date : xs_date -> xs_dayTimeDuration
val opt_timezone_from_date : xs_date -> xs_dayTimeDuration option
val year_from_dateTime : xs_dateTime -> int
val month_from_dateTime : xs_dateTime -> int
val day_from_dateTime : xs_dateTime -> int
val hours_from_dateTime : xs_dateTime -> int
val minutes_from_dateTime : xs_dateTime -> int
val seconds_from_dateTime : xs_dateTime -> Decimal._decimal
val timezone_from_dateTime : xs_dateTime -> xs_dayTimeDuration
val opt_timezone_from_dateTime : xs_dateTime -> xs_dayTimeDuration option
val date_from_dateTime : xs_dateTime -> xs_date
val time_from_dateTime : xs_dateTime -> xs_time

Context functions

val current_dateTime : unit -> xs_dateTime

Gives the current dateTime based upon the Unix system time set by the user for the operating system

val local_timezone : unit -> xs_dayTimeDuration

Gives the local timezone based upon the Unix system timezone set by the user.

val default_dateTime : unit -> xs_dateTime

Gives the dateTime corresponding the January 1st, 1970 at midnight. This is put in place to correspond to the Unix system calls which judge time based upon time elapsed since this default time

val default_UTC : unit -> xs_dayTimeDuration

Gives the dayTimeDuration corresponding to 0 days, 0 hours, 0 minutes, 0 seconds to represent the timezone offset at UTC

val adjust_time_to_timezone : xs_time -> xs_dayTimeDuration option -> xs_time

Adjusts the given time to the given timezone, or appends the timezone if there is no timezone attached to the given time

val adjust_date_to_timezone : xs_date -> xs_dayTimeDuration option -> xs_date

Adjusts the given date to the given timezone, or appends the timezone if there is no timezone attached to the given date

val adjust_dateTime_to_timezone : xs_dateTime ->
xs_dayTimeDuration option -> xs_dateTime

Adjusts the given dateTime to the given timezone, or appends the timezone if there is no timezone attached to the given dateTime

val yearMonthDuration_of_duration : xs_duration -> xs_yearMonthDuration
val dayTimeDuration_of_duration : xs_duration -> xs_dayTimeDuration
val duration_of_yearMonthDuration : xs_yearMonthDuration -> xs_duration
val duration_of_dayTimeDuration : xs_dayTimeDuration -> xs_duration
val negate_time : xs_time -> xs_time
val negate_date : xs_date -> xs_date
val negate_dateTime : xs_dateTime -> xs_dateTime
val negate_gYear : xs_gYear -> xs_gYear
val negate_gYearMonth : xs_gYearMonth -> xs_gYearMonth