7.2

### 4Combined Date and Time

The datetime struct represents the combination of a date and a time; that is, it represents a date at a particular time-of-day. However, it does not include time zone information, so it does not represent an absolute moment in time.

procedure

 (datetime year [ month day hour minute second nanosecond]) → datetime?
year : exact-integer?
month : (integer-in 1 12) = 1
day : (day-of-month/c year month) = 1
hour : (integer-in 0 23) = 0
minute : (integer-in 0 59) = 0
second : (integer-in 0 59) = 0
nanosecond : (integer-in 0 999999999) = 0
Constructs a datetime with the given date and time fields.

Examples:
 > (datetime 1970) # > (datetime 1969 7 21 2 56) #

 procedure x : any/c
Returns #t if x is a datetime; #f otherwise.

 procedure jd : real?
Returns the datetime corresponding to the given Julian day, which is the number of solar days that have elapsed since 12:00 UT on November 24, 4714 BC in the proleptic Gregorian calendar.

Examples:
 > (jd->datetime 0) # > (jd->datetime 2440587.5) #

 procedure(posix->datetime posix) → datetime? posix : real?
Returns the datetime corresponding to the given POSIX time, which is the number of seconds that have elapsed since 00:00 UTC on January 1, 1970.

Examples:
 > (posix->datetime 0) # > (posix->datetime 2147483648) #

 procedure dt : datetime?
Returns an ISO 8601 string representation of dt.

Examples:
 > (datetime->iso8601 (datetime 1970)) "1970-01-01T00:00:00" > (datetime->iso8601 (datetime 1969 7 21 2 56)) "1969-07-21T02:56:00" > (datetime->iso8601 (datetime 1 2 3 4 5 6 7)) "0001-02-03T04:05:06.000000007"

 procedure(datetime=? x y) → boolean? x : datetime? y : datetime?
 procedure(datetime
 procedure(datetime<=? x y) → boolean? x : datetime? y : datetime?
 procedure(datetime>? x y) → boolean? x : datetime? y : datetime?
 procedure(datetime>=? x y) → boolean? x : datetime? y : datetime?
Comparison functions on datetimes.

Examples:
 > (datetime=? (datetime 1970 1 1) (datetime 1970)) #t > (datetime (datetime>? (datetime 1970) (datetime 1969 7 21 2 56)) #t

 value
An order defined on datetimes.

Examples:
 > (datetime-order (datetime 1970 1 1) (datetime 1970)) '= > (datetime-order (datetime 1970) (datetime 1969 7 21 2 56)) '> > (datetime-order (datetime 1969 7 21 2 56) (datetime 1970)) '< > (make-splay-tree datetime-order) #