The date Module¶
The date
module is part of the System library and provides a
machine-independent facility for representing and manipulating dates and
date/time intervals.
Representing dates and times¶
The date
module contains a single class, <date>
, an instance of which
can represent any date between 1 Jan 1800 00:00:00 and 31 Dec 2199
23:59:59, Greenwich Mean Time. You can create a date object by calling
the function encode-date or using the make method for <date>
.
Each of the arguments to encode-date
and to the make
method on <date>
is an instance of
<integer>
(except for the iso8601-string keyword for the make
method, which is a string) that is passed as an init-keyword value to
the <date>
object. Each init-keyword takes an instance of
<integer>
, limited to the natural range for that attribute. For
example, month: can only take values between 1 and 12.
You must specify values, via encode-date
, for at least the
year:, month:, and day: init-keywords. In addition, you can also
specify values for hours:, minutes:, seconds:, microseconds:,
and time-zone-offset:. If not supplied, the default value for each of
these init-keywords is 0.
The time-zone-offset: init-keyword is used to represent time zones in
the date
module as <integer>
values representing the offset in minutes
from Greenwich Mean Time (GMT). Positive values are used for time zones
East of Greenwich; negative values represent time zones to the west of
Greenwich.
For example, the value -300 (-5 hours) is U.S. Eastern Standard Time and the value -240 (-4 hours) is U.S. Eastern Daylight Savings Time.
If you wish, a <date>
can be specified completely by using the
iso8601-string: init-keyword. This init-keyword takes an instance of
<string>
, which should be a valid ISO8601 format date. If you use the
iso8601-string: init-keyword, there is no need to specify any other
init-keywords to a call to make on <date>
.
Representing durations¶
Date/time intervals, called durations, are modeled in a style quite
similar to that of SQL. There are two, effectively disjoint, classes of
duration: one with a resolution of months (for example, 3 years, 2
months) and the other with a resolution of microseconds (for example, 50
days, 6 hours, 23 minutes). The first is <year/month-duration>
and the
second <day/time-duration>
.
An important distinction between <day/time-duration>
and
<year/month-duration>
is that a given instance of
<day/time-duration>
is always a fixed unit of a fixed length, whereas
a <year/month-duration>
follows the vagaries of the calendar. So if
you have a <date>
that represents, for example, the 5th of some month,
adding a <year/month-duration>
of 1 month to that will always take you
to the 5th of the following month, whether that is an interval of 28,
29, 30, or 31 days.
Performing operations on dates and durations¶
A number of interfaces are exported from the date
module that let you
perform other operations on dates and durations, and extract
date-specific information from your local machine.
Comparing dates¶
The following operations are exported from the date
module.
These methods let you perform arithmetic-like operations on dates to test for equality, or to test whether one date occurred before another.
Comparing durations¶
The following operations are exported from the date
module.
As with dates, you can perform arithmetic-like operations on durations to test for equality, or to test whether one duration is shorter than another.
Performing arithmetic operations¶
You can add, subtract, multiply, and divide dates and durations in a number of ways to produce a variety of date or duration information. Methods are defined for any combination of date and duration, with any operation that makes sense, and the return value is of the appropriate type.
For example, a method is defined that subtracts one date from another, and returns a duration, but there is no method for adding two dates together, since dates cannot be summed in any sensible way. However, there are methods for adding dates and durations which return dates.
Note that some addition and subtraction operations involving dates and
instances of <year/month-duration>
can cause
errors where the result is a date that does not exist in the calendar.
For example, adding one month to January 30th.
The table below summarizes the methods defined for each arithmetic operation, for different combinations of date and duration arguments, together with their return values.
Methods defined for arithmetic operations on dates and durations
Op |
Argument 1 |
Argument 2 |
Return value |
---|---|---|---|
Dealing with time-zones¶
The following functions return information about the time-zone that the host machine is in.
Extracting information from dates¶
A number of functions are available to return discrete pieces of
information from a specified <date>
object. These are useful to allow
you to deconstruct a given date in order to retrieve useful information
from it.
The most basic way to extract information from a date is to use the function decode-date.
-
Decodes a
<date>
into its constituent parts. This function is the companion of encode-date, in that it takes a<date>
object and returns all of its constituent parts. Note, however, that in contrast to encode-date, it does not return any millisecond component to the date, but it does return the day of the week of the specified date.
A number of other functions exist to extract individual components from
a <date>
object. Each of these functions is listed below. Each
function takes a single argument, a <date>
object, and returns the
component of the date referred to in the function name. For example,
date-month takes a <date>
object as an argument, and returns the
month that the date refers to.
For each function except date-day-of-week, the value returned is an
instance of <integer>
. The date-day-of-week function returns an
object of type <day-of-week>
. For more information, please refer to
the reference entries of each function. Also see the function
date-time-zone-offset-setter
, which allows you to set
the time-zone offset of a <date>
explicitly.
Formatting Dates¶
To return an ISO 8601 format date from a <date>
object, use the
function as-iso8601-string
.
Dates can also be returned in RFC-822 and RFC-1123 formats with the
as-rfc822-string
and as-rfc1123-string
functions.
More flexible date formatting is available with format-date
.
Parsing Dates¶
Dates can be parsed with parse-date-string
. ISO-8601 formatted
date strings can be parsed with parse-iso8601-string
.
The date module¶
This section contains a reference entry for each item exported from the Date module.
- =(<date>) Sealed Method¶
Compares two dates for equality.
- Signature:
date1 = date2 => equal?
- Parameters:
- Values:
equal? – An instance of
<boolean>
.
- Discussion:
This method lets you compare two dates to see if they are equal. Any differences in microseconds between date1 and date2 are ignored.
- See also:
- =(<duration>) Sealed Method¶
Compares two durations for equality.
- Signature:
duration1 = duration2 => equal?
- Parameters:
duration1 – An instance of
<duration>
.duration2 – An instance of
<duration>
.
- Values:
equal? – An instance of
<boolean>
.
- Discussion:
This method lets you compare two durations to see if they are equal. If the durations are actually instances of
<day/time-duration>
, any differences in microseconds between duration1 and duration2 are ignored.- See also:
- <(<date>) Sealed Method¶
Determines whether one date is earlier than another.
- Signature:
date1 < date2 => before?
- Parameters:
- Values:
before? – An instance of
<boolean>
.
- Discussion:
This method determines if date1 is earlier than date2. Any differences in microseconds between date1 and date2 are ignored.
- See also:
- <(<duration>) Sealed Method¶
Determines whether one duration is less than another.
- Signature:
duration1 < duration2 => less-than?
- Parameters:
duration1 – An instance of
<duration>
.duration2 – An instance of
<duration>
.
- Values:
less-than? – An instance of
<boolean>
.
- Discussion:
This method determines if duration1 is less than duration2. If the durations are actually instances of
<day/time-duration>
, any differences in microseconds between duration1 and duration2 are ignored.- See also:
- +(<date>) Sealed Method¶
Performs addition on specific combinations of dates and durations.
- Signature:
arg1 arg2 => sum
- Parameters:
arg1 – An instance of
<date>
or<duration>
. See description for details.arg2 – An instance of
<date>
or<duration>
. See description for details.
- Values:
sum – An instance of
<date>
.
- Discussion:
A number of methods are defined for the
+
generic function to allow summing of various combinations of dates and durations. Note that there is not a method defined for every possible combination of date and duration. Specifically, you cannot sum two dates. The table below lists the methods that are defined on+
and<date>
.Methods defined for addition of dates and durations
arg1
arg2
sum
- See also:
- +(<duration>) Sealed Method¶
Performs addition on durations.
- Signature:
arg1 arg2 => sum
- Parameters:
arg1 – An instance of
<duration>
.arg2 – An instance of
<duration>
.
- Values:
sum – An instance of
<duration>
.
- Discussion:
A number of methods are defined for the
+
generic function to allow summing of durations. Note that there is not a method defined for every possible combination of duration. Specifically, you cannot sum different types of duration. The table below lists the methods that are defined on+
.Methods defined for addition of durations
- See also:
- -(<date>) Sealed Method¶
Performs subtraction on specific combinations of dates and durations.
- Signature:
arg1 arg2 => diff
- Parameters:
arg1 – An instance of
<date>
or<duration>
. See description for details.arg2 – An instance of
<duration>
, or an instance of<date>
if arg1 is a<date>
. See description for details.
- Values:
diff – An instance of
<date>
or<duration>
. See description for details.
- Discussion:
A number of methods are defined for the
-
generic function to allow subtraction of various combinations of dates and durations. Note that there is not a method defined for every possible combination of date and duration. Specifically, you cannot subtract a date from a duration, and you cannot subtract different types of duration. The return value can be either a date or a duration, depending on the arguments supplied. The table below lists the methods that are defined on-
.Methods defined for subtraction of dates and durations
arg1
arg2
difference
- See also:
- -(<duration>) Sealed Method¶
Performs subtraction on specific combinations of durations.
- Signature:
arg1 arg2 => diff
- Parameters:
arg1 – An instance of
<date>
or<duration>
. See description for details.arg2 – An instance of
<duration>
, or an instance of<date>
if arg1 is a<date>
. See description for details.
- Values:
diff – An instance of
<date>
or<duration>
. See description for details.
- Discussion:
A number of methods are defined for the
-
generic function to allow subtraction of durations. Note that there is not a method defined for every possible combination of duration. Specifically, you cannot subtract different types of duration. The table below lists the methods that are defined on-
.Methods defined for subtraction of dates and durations
- See also:
- *(<duration>) Sealed Method¶
Multiplies a duration by a scale factor.
- Signature:
* duration scale => new-duration
- Signature:
* scale duration => new-duration
- Parameters:
duration – An instance of
<duration>
.scale – An instance of
<real>
.
- Values:
new-duration – An instance of
<duration>
.
- Discussion:
Note: These arguments can be expressed in any order.
Multiples a duration by a scale factor and returns the result. Note that the arguments can be expressed in any order: methods are defined such that the duration can be placed first or second in the list of arguments.
- See also:
- /(<duration>) Sealed Method¶
Divides a duration by a scale factor
- Signature:
/ duration scale => new-duration
- Parameters:
duration – An instance of
<duration>
.scale – An instance of
<real>
.
- Values:
new-duration – An instance of
<duration>
.
- Discussion:
- See also:
- as-iso8601-string Function¶
Returns a string representation of a date, conforming to the ISO 8601 standard.
- Signature:
as-iso8601-string date #key precision => iso8601-string
- Parameters:
- Values:
iso8601-string – An instance of
<string>
.
- Discussion:
Returns a string representation of date using the format identified by International Standard ISO 8601 (for example,
"19960418T210634Z"
). If precision is non-zero, the specified number of digits of a fraction of a second are included in the string (for example,"19960418T210634.0034Z"
).The returned string always expresses the time in Greenwich Mean Time. The iso8601-string init-keyword for
<date>
, however, accepts ISO 8601 strings with other time zone specifications.This is the same as calling:
format-date("%Y-%m-%dT%H:%M:%S%:z", date);
- See also:
- as-rfc822-string Function¶
Returns a string representation of a date, conforming to RFC 822.
- as-rfc1123-string Function¶
Returns a string representation of a date, conforming to RFC 1123.
- Signature:
as-rfc1123-string date => rfc1123-string
- Parameters:
date – An instance of
<date>
.
- Values:
rfc1123-string – An instance of
<string>
.
- Discussion:
The date format for RFC-1123 is the same as for RFC-822 except that the year must be 4 digits rather than 2:
Sun, 01 Sep 2013 17:00:00 GMT
This is the same as calling:
format-date("%a, %d %b %Y %H:%M:%S %z", date);
This format is commonly used in email, HTTP headers, RSS feeds and other protocols where date representations are used.
- See also:
- current-date Function¶
Returns a date object representing the current date and time.
- Signature:
current-date () => date
- Values:
date – An instance of
<date>
.
- Discussion:
Returns date for the current date and time.
- <date> Sealed Class¶
The class of objects representing dates.
- Superclasses:
- Init-Keywords:
iso8601-string – An instance of
false-or(<string>)
. Default value:#f
.year – An instance of
limited(<integer>, min: 1800, max: 2199)
.month – An instance of
limited(<integer>, min: 1, max: 12)
.day – An instance of
limited(<integer>, min: 1, max: 31)
.hours – An instance of
limited(<integer>, min: 0, max: 23)
. Default value: 0.minutes – An instance of
limited(<integer>, min: 0, max: 59)
. Default value: 0.seconds – An instance of
limited(<integer>, min: 0, max: 59)
. Default value: 0.microseconds – An instance of
limited(<integer>, min: 0, max: 999999)
. Default value: 0.time-zone-offset – An instance of
<integer>
. Default value: 0.
- Discussion:
Represents a date and time between 1 Jan 1800 00:00:00 and 31 Dec 2199 23:59:59, Greenwich Mean Time (GMT).
A
<date>
can be specified to microsecond precision and includes a time zone indication.If supplied, the iso8601-string: init-keyword completely specifies the value of the
<date>
. Otherwise, the year:, month:, and day: init-keywords must be supplied. Note that, although you can supply ISO 8601 strings that represent any time zone specification, the related functionas-iso8601-string
always returns an ISO 8601 string representing a time in Greenwich Mean Time.For the time-zone-offset init-keyword, a positive number represents an offset ahead of GMT, in minutes, and a negative number represents an offset behind GMT. The value returned is an instance of
<integer>
(for example, -300 represents the offset for EST, which is 5 hours behind GMT).- Operations:
- See also:
- date-day Function¶
Returns the day of the month component of a specified date.
- Signature:
date-day date => day
- Parameters:
date – An instance of
<date>
.
- Values:
day – An instance of
<integer>
.
- Discussion:
Returns the day of the month component of the specified date. For example, if passed a
<date>
that represented 16:36 on the 20th June, 1997, date-day returns the value 20.- See also:
- date-day-of-week Function¶
Returns the day of the week of a specified date.
- Signature:
date-day-of-week date => day-of-week
- Parameters:
date – An instance of
<date>
.
- Values:
day-of-week – An object of type
<day-of-week>
.
- Discussion:
Returns the day of the week of the specified date.
- See also:
- date-hours Function¶
Returns the hour component of a specified date.
- date-microseconds Function¶
Returns the microseconds component of a specified date.
- Signature:
date-microseconds date => microseconds
- Parameters:
date – An instance of
<date>
.
- Values:
microseconds – An instance of
<integer>
.
- Discussion:
Returns the microseconds component of the specified date. Note that this does not return the entire date object, represented as a number of microseconds; it returns any value assigned to the microseconds: init-keyword when the
<date>
object was created.- See also:
- date-minutes Function¶
Returns the minutes component of a specified date.
- date-month Function¶
Returns the month of a specified date.
- date-seconds Function¶
Returns the seconds component of a specified date.
- Signature:
date-seconds date => seconds
- Parameters:
date – An instance of
<date>
.
- Values:
seconds – An instance of
<integer>
.
- Discussion:
Returns the seconds component of the specified date. Note that this does not return the entire date object, represented as a number of seconds; it returns any value assigned to the seconds: init-keyword when the
<date>
object was created.- See also:
- date-time-zone-offset Function¶
Returns the time zone offset of a specified date.
- Signature:
date-time-zone-offset date => time-zone-offset
- Parameters:
date – An instance of
<date>
.
- Values:
time-zone-offset – An instance of
<integer>
.
- Discussion:
Returns the time zone offset of the specified date. The values of the other components of date reflect this time zone.
A positive number represents an offset ahead of GMT, in minutes, and a negative number represents an offset behind GMT. The value returned is an instance of
<integer>
(for example, -300 represents the offset for EST, which is 5 hours behind GMT).- See also:
- date-time-zone-offset-setter Function¶
Change the time zone offset of a specified date, while maintaining the same point in time.
- Signature:
date-time-zone-offset-setter new-time-zone-offset date => new-time-zone-offset
- Parameters:
- Values:
new-time-zone-offset – An instance of
<integer>
.
- Discussion:
Changes the time zone offset of date without changing the actual point in time identified by the date. The values of the other components of date are adjusted to reflect the new time zone.
The new-time-zone-offset argument should represent the offset from GMT, in minutes. Thus, if you wish to specify a new offset representing EST, which is 5 hours behind GMT, new-time-zone-offset should have the value -300.
- See also:
- date-year Function¶
Returns the year of a specified date.
:: todo Make this a type.
- <day-of-week> Class¶
The days of the week.
- Discussion:
The days of the week. This is the type of the return value of the
date-day-of-week
function.one-of(#"Sunday", #"Monday", #"Tuesday", #"Wednesday", #"Thursday", #"Friday", #"Saturday")
- Operations:
- See also:
- <day/time-duration> Sealed Class¶
The class of objects representing durations in units of microseconds.
- Superclasses:
- Init-Keywords:
- Discussion:
The class of objects representing durations in units of microseconds. It is a subclass of
<duration>
.Use this class to represent a number of days and fractions thereof. If you need to represent durations in calendar units of months or years, use
<year/month-duration>
instead.- Operations:
- See also:
- decode-date Function¶
Returns the date and time stored in a date object.
- Signature:
decode-date date => year month day hours minutes seconds day-of-week time-zone-offset
- Parameters:
date – An instance of
<date>
.
- Values:
- Discussion:
Returns the date and time stored in date.
Note that it does not return the millisecond component of a
<date>
, but it does return the appropriate<day-of-week>
.- See also:
- decode-duration Sealed Generic function¶
Decodes a duration into its constituent parts.
- Signature:
decode-duration duration => #rest components
- Parameters:
duration – An instance of
<duration>
.
- Values:
#rest components – Instances of
<integer>
.
- Discussion:
Decodes an instance of
<duration>
into its constituent parts. There are methods for this generic function that specialize on<year/month-duration>
and<day/time-duration>
respectively, as described below.- See also:
- decode-duration(<day/time-duration>) Sealed Method¶
Decodes a day/time duration into its constituent parts.
- Signature:
decode-duration duration => days hours minutes seconds microseconds
- Parameters:
duration – An instance of
<day/time-duration>
.
- Values:
- Discussion:
Decodes an instance of
<day/time-duration>
into its constituent parts.- See also:
- decode-duration(<year/month-duration>) Sealed Method¶
Decodes a year/month duration into its constituent parts.
- Signature:
decode-duration duration => years months
- Parameters:
duration – An instance of
<year/month-duration>
.
- Values:
- Discussion:
Decodes an instance of
<year/month-duration>
into its constituent parts.- See also:
- <duration> Abstract Instantiable Sealed Class¶
The class of objects representing durations.
- Superclasses:
- Init-Keywords:
iso8601-string – An instance of
false-or(<string>)
. Default value:#f
.year – An instance of
limited(<integer>, min: 1800, max: 2199)
.month – An instance of
limited(<integer>, min: 1, max: 12)
.day – An instance of
limited(<integer>, min: 1, max: 31)
.hours – An instance of
limited(<integer>, min: 0, max: 23)
. Default value: 0.minutes – An instance of
limited(<integer>, min: 0, max: 59)
. Default value: 0.seconds – An instance of
limited(<integer>, min: 0, max: 59)
. Default value: 0.microseconds – An instance of
limited(<integer>, min: 0, max: 999999)
. Default value: 0.time-zone-offset – An instance of
<integer>
. Default value: 0.
- Discussion:
This class is the used to represent durations. It is a subclass of
<number>
, and it has two subclasses.- Operations:
- See also:
- encode-date Function¶
Creates a date object for the specified date and time.
- Signature:
encode-date year month day hours minutes seconds #key*microseconds time-zone-offset* => date
- Parameters:
year – An instance of
<integer>
.month – An instance of
<integer>
.day – An instance of
<integer>
.hours – An instance of
<integer>
.minutes – An instance of
<integer>
.seconds – An instance of
<integer>
.microseconds (#key) – An instance of
<integer>
. Default value: 0.#keytime-zone-offset – An instance of
<integer>
. Default value:local-time-zone-offset()
.
- Values:
date – An instance of
<date>
.
- Discussion:
Creates a
<date>
object for the specified date and time.- See also:
- encode-day/time-duration Function¶
Creates a day/time duration from a set of integer values.
- Signature:
encode-day/time-duration days hours minutes seconds microseconds => duration
- Parameters:
- Values:
duration – An instance of
<day/time-duration>
.
- Discussion:
Creates an instance of
<day/time-duration>
.- See also:
- encode-year/month-duration Function¶
Creates a year/month duration from a set of integer values.
- Signature:
encode-year/month-duration years months => duration
- Parameters:
- Values:
duration – An instance of
<year/month-duration>
.
- Discussion:
Creates an instance of
<year/month-duration>
.- See also:
- format-date Function¶
Formats a date according to a format string.
- Signature:
format-date format date => formatted-date
- Parameters:
format – An instance of
<byte-string>
.date – An instance of
<date>
.
- Values:
formatted-date – An instance of
<byte-string>
.
- Discussion:
format-date
interprets a control string,format
, to create a string representing thedate
.The control string can contain these directives:
%Y
- The year.%y
- The year, in 2 digit form.%H
- Hours, zero padded.%k
- Hours, space padded.%M
- Minutes, zero padded.%S
- Seconds, zero padded.%f
- Microseconds, 6 digits.%F
- Milliseconds, 3 digits.%T
- Time, each component zero padded.%m
- Month in numeric form, zero padded.%d
- Day of the month, zero padded.%e
- Day of the month, space padded.%A
- Name of the day of the week.%a
- Short name of the day of the week.%B
- Name of the month.%b
- Short name of the month.%z
- Time zone offset.%:z
- Time zone offset, but using:
between hours and minutes.%n
- A new line.%%
- A % character.
- See also:
- local-daylight-savings-time? Function¶
Checks whether the local machine is using Daylight Savings Time.
- local-time-zone-name Function¶
Returns the time zone name in use by the local machine.
- Signature:
local-time-zone-name () => time-zone-name
- Values:
time-zone-name – An instance of
<string>
.
- Discussion:
Returns the time zone name in use by the local machine, if available, or a string of the form
+/-HHMM
if the time zone name is unknown.
- local-time-zone-offset Function¶
Returns the offset of the time-zone from Greenwich Mean Time, expressed as a number of minutes.
- Signature:
local-time-zone-offset () => time-zone-offset
- Values:
time-zone-offset – An instance of
<integer>
.
- Discussion:
Returns the offset of the time-zone from Greenwich Mean Time, expressed as a number of minutes. A positive number represents an offset ahead of GMT, and a negative number represents an offset behind GMT. The return value is an instance of
<integer>
(for example, -300 represents the offset for EST, which is 5 hours behind GMT). The return value incorporates daylight savings time when necessary.
- make(<date>) Method¶
Creates an instance of the
<date>
class.- Signature:
make date-class #key iso8601-string year month day hours minutes seconds microseconds time-zone-offset => date-instance
- Parameters:
date-class – The class
<date>
.iso8601-string (#key) – An instance of
false-or(<string>)
. Default value:#f
.year (#key) – An instance of
limited(<integer>, min: 1800, max: 2199)
.month (#key) – An instance of
limited(<integer>, min: 1, max: 12)
.day (#key) – An instance of
limited(<integer>, min: 1, max: 31)
.hours (#key) – An instance of
limited(<integer>, min: 0, max: 23)
. Default value: 0.minutes (#key) – An instance of
limited(<integer>, min: 0, max: 59)
. Default value: 0.seconds (#key) – An instance of
limited(<integer>, min: 0, max: 59)
. Default value: 0.microseconds (#key) – An instance of
limited(<integer>, min: 0, max: 999999)
. Default value: 0.time-zone-offset (#key) – An instance of
<integer>
. Default value: 0.
- Values:
date-instance – An instance of
<date>
.
- Discussion:
Creates an instance of
<date>
.The make method on
<date>
takes the same keywords as the<date>
class.Note: The iso8601-string keyword accepts a richer subset of the ISO 8601 specification than is produced by the
as-iso8601-string
function. Seeparse-iso8601-string
for details.- Example:
make (<date>, iso8601-string: "19970717T1148-0400")
- See also:
- parse-date-string Function¶
Parse a date in string form according to a control string, returning a date.
- Signature:
parse-date-string date format => date
- Parameters:
- Values:
date – An instance of
<date>
.
- Discussion:
Parses a date in string form according to a control string,
format
. The control string uses the same directives asformat-date
.- See also:
- parse-iso8601-string Function¶
Parse a variety of variants on ISO-8601 formatted date strings.
- Signature:
parse-iso8601-string string #key strict? => date
- Parameters:
- Values:
date – An instance of
<date>
.
- Discussion:
This function parses the ISO 8601 formats listed below, with the following differences if strict? = #f:
the ‘-’ in YYYY-MM-DD is optional
the ‘:’ in hh:mm:ss is optional
the ‘:’ in the timezone is optional
the date and time may be separated by a space character
TZD may be preceded by a space character
See https://www.w3.org/TR/NOTE-datetime.html.
- Year:
YYYY (eg 1997)
- Year and month:
YYYY-MM (eg 1997-07)
- Complete date:
YYYY-MM-DD (eg 1997-07-16)
- Complete date plus hours and minutes:
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
- Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
- Complete date plus hours, minutes, seconds and a decimal fraction of a second
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
- where:
YYYY = four-digit year
MM = two-digit month (01=January, etc.)
DD = two-digit day of month (01 through 31)
hh = two digits of hour (00 through 23) (am/pm NOT allowed)
mm = two digits of minute (00 through 59)
ss = two digits of second (00 through 59)
s = one or more digits representing a decimal fraction of a second
TZD = time zone designator (Z or +hh:mm or -hh:mm)
- See also:
- <year/month-duration> Sealed Class¶
The class of objects representing durations with a coarse resolution.
- Superclasses:
- Init-Keywords:
- Discussion:
The class of objects representing durations in units of calendar years and months. It is a subclass of
<duration>
.Use this class to represent a number of calendar years and months. If you need to represent durations in units of days or fractions thereof (to microsecond resolution), use
<day/time-duration>
instead.- Operations:
- See also: