Close
Close window
Format - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

Calendar

Format

format a Date or UTC Time object as a string

Parse

parse a string to a Date object with respect to a given format string

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 (').

For an alternative way to provide format strings, see Calendar[VariantFormat] .

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

>

withCalendar:

>

sFormatToday

s2025年03月24日T10:25:19 UTC

(1)
>

Parses

<Date: 2025年03月24日T10:25:19 GMT>

(2)
>

FormatToday&comma;'The day of the week is 'eeee

The day of the week is Monday

(3)
>

sFormatToday&comma;EEEE, MMMM dd, yyyy GG 'at' hh:mm:ss a

sMonday, March 24, 2025 AD at 10:25:19 AM

(4)
>

Parses&comma;EEEE, MMMM dd, yyyy GG 'at' hh:mm:ss a

<Date: 2025年03月24日T10:25:19 GMT>

(5)
>

tFormatNowSystemUTCClock

t2025年03月24日T10:25:19 UTC

(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.

>

Parset

<Date: 2025年03月24日T10:25:19 GMT>

(7)

To use a locale different from the default locale, use the locale= option.

>

FormatToday&comma;EEEE, MMMM dd, yyyy GG, hh:mm:ss a&comma;locale=ja

月曜日, 3月 24, 2025 西暦, 10:25:19 午前

(8)
>

FormatToday&comma;EEEE, MMMM dd, yyyy GG 'jam' hh:mm:ss a&comma;locale=id

Senin, Maret 24, 2025 M jam 10:25:19 AM

(9)
>

sFormatToday&comma;EEEE, MMMM dd, yyyy GG 'um' hh:mm:ss a&comma;locale=de

sMontag, März 24, 2025 n. Chr. um 10:25:19 AM

(10)
>

Parses&comma;EEEE, MMMM dd, yyyy GG 'um' hh:mm:ss a&comma;locale=de

<Date: 2025年03月24日T10:25:19 GMT>

(11)
>

sFormatDate42&comma;3&comma;15&comma;3&comma;4&comma;5&comma;EEEE, MMMM dd, yyyy GGGGGGG 'jam' hh:mm:ss a&comma;locale=id

sKamis, Maret 15, 0043 SM jam 03:04:05 AM

(12)
>

Parses&comma;EEEE, MMMM dd, yyyy GGGGGGG 'jam' hh:mm:ss a&comma;locale=id

<Date: 0043年03月15日T03:04:05 GMT>

(13)

References

Compatibility

The Calendar[Format] and Calendar[Parse] commands were introduced in Maple 2019.

For more information on Maple 2019 changes, see Updates in Maple 2019 .


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /