|
Calling Sequence
|
|
Format( d, fmt )
Parse( s, fmt )
|
|
Parameters
|
|
d
|
-
|
Date; a Date object
|
s
|
-
|
string; string to parse
|
fmt
|
-
|
string; (optional) a format string
|
|
|
|
|
Options
|
|
•
|
locale : string; the name of a locale to use
|
|
|
Description
|
|
•
|
Dates (and Time objects) can be formatted to a string by using the Format( d, fmt ) command.
|
•
|
A string containing date information can be parsed to produce a corresponding Date object by using the Parse( s, fmt ) command.
|
•
|
The format string fmt is a string of free-form text with embedded formatting codes specified in the Unicode Technical Standard #35. Note that literal text in fmt must be quoted with single (forward) quotes (').
|
•
|
The format string fmt is optional. Its default value is the string "yyyy-MM-dd'T'HH:mm:ss zzz".
|
•
|
Use the locale = loc option to control which locale formatting and parsing occurs in. The loc value should be a two-letter language code (E.g., "id" for Indonesian), optionally separated by an underscore character ("_") from a country variant indicates by using a two- or three-letter country code. (E.g., "fr_CA" for Canadian French.)
|
•
|
For some of the examples below to print correctly, you may need special fonts to be installed on your computer.
|
|
|
Examples
|
|
| (1) |
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
Note that the output of Parse is always a Date object; the source of the input string as a formatted Time object is unknown to the Parse command.
| (7) |
To use a locale different from the default locale, use the locale= option.
>
|
|
| (8) |
>
|
|
| (9) |
>
|
|
| (10) |
>
|
|
| (11) |
>
|
|
| (12) |
>
|
|
| (13) |
|
|
References
|
|
|
|
Compatibility
|
|
•
|
The Calendar[Format] and Calendar[Parse] commands were introduced in Maple 2019.
|
|
|
|