Date and time format options and properties

<< Click to Display Table of Contents >>

Manual > Appendix > Date and time format >

Date and time format options and properties

Date and time format options and properties

The date and time format has "options" and "properties". These are used in the following situations:

 

When specifying the date and time format: Options and properties can be specified

When defining a user format...Properties can be specified

 

 

■ Date and time format options

 

When specifying the date and time format, you can specify options and properties using the following format:

 

@datetimeformatname.optionformat[.optionformat][.optionformat]... <propertyformat>

 

To specify options, add any optional format separated by a dot character "." after the date and time format name such as @DATETIME.

In addition, the date and time format option format allows you to list multiple options, such as @DATETIME.optionformat.optionformat.optionformat .

In addition, you can change properties such as the time zone (TimeZone) by specifying a property format as at the end of the date and time format. When specifying multiple properties, separate each property with a semicolon, for example, .

 

Example of date and time format:

 

@DATETIME * Example of no options specified

 

2017/02/18 16:56:20

 

@DATETIME.D

 

2017/02/18...Only the date is displayed depending on the option

 

@DATETIME.T.D

 

16:56:20 2017/02/18 ... Display the time and date in the order specified in the options.

 

@DATETIME.DT<TimeZone=US Eastern Standard Time>

 

2017/02/18 02:56:20 ...Time zone change by property specification

 

@DATETIME.%YmdHMSps<AM=am.;PM=pm.;DTSep=^;TZ=US Eastern Standard Time>

 

2017/02/18^02:56:20 am. ... Display in a unique format by specifying options and properties

 

 

hint

When specifying multiple options when specifying the format, you can list them separated by periods, such as ".D.T".

In this case, please make sure there are no spaces between the options you list (for example, ".D .T" is not allowed).

 

hint

When specifying a format, you can specify multiple properties by separating each property with a semicolon, like so: . You can also specify a list of <> pairs, like so: ...

When listing <> pairs, make sure not to put any characters between the <> (spaces are also not allowed).

 

 

Date and time format options

There are three date and time format options available:

 

Simple Option Format

Select Option Format

User Option Format

 

 

■ Simple option format

   

The simple option format is a simplified version of some of the more commonly used formats.

The same expression is possible using the "select option format" described below, but the simple option format allows for a simpler definition.

 

Simple Option Format

DT

Date and time Example: @DATETIME.DT.UTC ... equivalent to "@DATETIME.%YmdHMS.UTC"


D

Date Example: @DATETIME.D ... equivalent to "@DATETIME.%Ymd"


T

Time Example: @DATETIME.T ... equivalent to "@DATETIME.%HMS"


DST

When it is daylight saving time, add the character (default "DST") (same as when "%g" is added in the selection option format).


UTC

Add the time difference from UTC. (Same as when "%e" is added in the selection option format.)


MS

Adds milliseconds. (Same as adding "%#t" to the selection option format.)

 

Example) When Locale is "ja" *Excluding the DST example

 

Date and time format examples

Display example

@DATETIME

2017/02/18 13:55:42

@DATETIME.D

2017/02/18

@DATETIME.T

13:55:42

@DATETIME.DT.MS

2017/02/18 13:55:42.123

@DATETIME.DT.UTC

2017/02/18 13:55:42 +0900

@DATETIME.DT.DST

2017/02/18 13:55:42 DST *"DST" is displayed only during daylight saving time.

@DATETIME.T.D

13:55:42 2017/02/18

 

 

■Selection option format

 

In the selection option format, you can specify the formatting characters you want to display by listing them after ".%".

For example, if you specify "@DATETIME.%Ym", only the year and month will be displayed. (For Japan (ja), it will be displayed as "2017/02", and for France (fr), it will be displayed as "02/2017".)

Or, if you specify "@DATETIME.%ymdHM", it will be displayed as "17/02/18 13:55" in Japan (ja). Note that you can combine the selection option format and the simple option format (for example, "@DATETIME.DT.%p").

 

Formatting Characters

Y

Year 4 digits


y

Last two digits of the year (00-99)


m

Month (01-12)


d

Day (01-31)


H

Hour in 24-hour format (00-23)


I

Hour in 12-hour format (01-12)


M

Minute (00 to 59)


S

Second (00 to 59)


p

Characters representing AM/PM (depending on locale)


ps

Characters representing AM/PM (depending on the locale), with a blank between them and the time.


P

Characters that represent AM/PM (displayed as AM/PM regardless of locale)


Ps

Characters representing AM/PM (displayed as AM/PM regardless of locale). Displayed with one blank character between the time and the date.


T

Add milliseconds (000 to 999)


t

Add milliseconds with "." (.001 to .999)


e

Add the time difference from UTC (+mmss)


g

When daylight saving time is in effect, the character (default is "DST") is added.


B

Full month name (January, February etc.)


b

Abbreviated month name (Jan, Feb etc.)

 

* If you put a # before a supported formatting character as shown below, the leading zero will be removed before displaying it.

  %#Y, %#y, %#m,  %#d, %#H, %#I, %#M, %#S, %#t, %#T

*The following will be ignored even if you add a #.

  %#P, %#Ps, %#p, %#ps, %#e, %#g, %#b, %#B

 

Example) If Locale is "ja"

 

Date and time format examples

Display example

@DATETIME.%Ym

2017/02

@DATETIME.%Y#m

2017/2

@DATETIME.%IMp

13:55PM, 13:55 PM, etc. (The symbols will change depending on the time format settings of your OS)

@DATETIME.%IMps

13:55 PM, 13:55 PM, etc. (same as above)

@DATETIME.%pIM

13:55 PM, 13:55 PM, etc. (same as above)

@DATETIME.%ymdHM

17/02/18 13:55

 

 

hint

In the selection option format, you can define % followed by a format letter such as Y or m. For example, %Ym and %Y%m have the same result.

The order in which the formatting characters are specified can be specified in any order with the exception of "p", "ps", "P", and "PS" (%Ym and %mY will produce the same result). As an exception, for "p"-related formatting characters that display notations such as AM/PM, the decision as to whether to display the AM/PM notation before or after the time is determined by the position in which the formatting character is written. Specifically, AM/PM will be displayed at the beginning only if a "p"-related character is written at the beginning, and will be displayed at the end if written in any other position.

 

example)

For @DATETIME.%pIM, AM/PM will be displayed at the beginning and the result will be "PM08:12".

For @DATETIME.%IMp, AM/PM will be displayed at the end, resulting in "08:12PM".

 

 

 

■User option format

 

When specifying options, you can specify any date format by enclosing it in [].

 

The user option format is used when creating special formats such as when displaying headers and footers.

 

Setting example)

 

@DATETIME.[HEADER ].D

 

HEADER 2016/01/01 ... Add the prefix "HEADER" to the beginning

 

@DATETIME.T.[ %#Tms]

 

10:11:12 12ms ... milliseconds + ms added

 

 

Date and Time Format Property Format

The properties that can be specified in the date and time format are as follows:

 

■List of date and time format properties

 

Properties

specification

All = Date and time format name

It inherits all the properties of the date and time format specified by the date and time format name.

 

Example) All = @LOCALE ... inherits all properties of @LOCALE

 

Base=Format characters

You can specify the settings for the Base property of the user format.

For details about the format that can be specified for this property, see "Format for Base Properties" on this page.

 

Format = format character

You can specify the settings for the Format property of the user format.

For details about the format that can be specified for this property, see "Format for Format property" on this page.

 

TimeZone = Time zone name

TZ=timezone name

You can specify the time zone name (abbreviation: TZ).

For details, see "About time zone names".

 

DST = Daylight saving time display character

Specifies the text to display for daylight saving time (default is "DST". Used when %g is specified)

 

DTSep = String between date and time

Specifies the character between the date and the time (default is one space).

You can include a newline character in the string by specifying "$RET$".

For example, if you specify @DATETIME, it will be displayed as follows.

 

2020/5/14

09:57:23

 

AM = Letters indicating morning

Specifies the character that represents am (used when %p is specified)

PM = Afternoon letter

Specifies the pm character (used when %p is specified)

Sunday = Sunday's full name

Specifies the full name of the day of the week (used when %A is specified)

Monday = Monday's official name

Ibid.

Tuesday = Tuesday's official name

Ibid.

Wednesday = Wednesday's full name

Ibid.

Thursday = Thursday's official name

Ibid.

Friday = Friday's official name

Ibid.

Saturday = Saturday's full name

Ibid.

ShortSunday = Short name of Sunday

Specifies the abbreviated name of the day of the week (used when %a is specified)

ShortMonday = Short name of Monday

Ibid.

ShortTuesday = Short name for Tuesday

Ibid.

ShortWednesday = Wednesday abbreviation

Ibid.

ShortThursday = Short name of Thursday

Ibid.

ShortFriday = Friday abbreviation

Ibid.

ShortSaturday = Saturday abbreviation

Ibid.

January = Full name of January

Specifies the full name of the month (used when %B is specified)

February = Full name of February

Ibid.

March = March's official name

Ibid.

April=April's official name

Ibid.

May = May's official name

Ibid.

June = the official name of June

Ibid.

July = full name of July

Ibid.

August = August's official name

Ibid.

Seprember=Official name of September

Ibid.

October=Official name of October

Ibid.

November = November's official name

Ibid.

December = Full name of December

Ibid.

ShortJanuary = Short name of January

Specifies the abbreviated name of the month (used when %b is specified)

ShortFebruary = Short name of February

Ibid.

ShortMarch = Short name of March

Ibid.

ShortApril = Short name of April

Ibid.

ShortMay = Short name of May

Ibid.

ShortJune = Short name of June

Ibid.

ShortJuly = Short name of July

Ibid.

ShortAugust = abbreviated name of August

Ibid.

ShortSeprember=Abbreviated name of September

Ibid.

ShortOctober = Short name of October

Ibid.

ShortNovember = Short name of November

Ibid.

ShortDecember = Short name of December

Ibid.

 

hint

The prohibited characters for parameters specified on the right side of a property (the "xxx" part of property name = xxx) are as follows.

 

";" - semicolon

"><" - A string of characters consisting of the above characters repeated consecutively. <DST=<aaa>> is OK. <DST=<aaa><bbb>> is not OK.

 

 

 

■Base property format

 

The Base property of the date and time format must be defined according to this format.

 

The Base property format is used when you want to add options (.D / .T / .DST, etc.) when using it.

In the Base property definition,Specify all of the following characters (ymdHMS) without any omissions.It is necessary.

 

y Year part

m Part of the moon

d Day part

H        Time part

M        minutes

S Seconds part

 

Example) Base=y-m-d H:M:S

 

 

■Format property format

 

The Format property of the date and time format must be defined according to this format.

 

The format for the Format property can be freely specified by the user. If you define it using the format property, there is a restriction that you cannot specify options when calling the date and time format (you cannot call it with .D / .T / .DST, etc.). If you need to use it with options, do not use the Format property, but define it using the Base property.

 

The formats that can be specified are as follows:

 

Basic format

%Y

Year 4 digits


%y

Last two digits of the year (00-99)


%m

Month (01-12)


%d

Day (01-31)


%H

Hour in 24-hour format (00-23)


%I

Hour in 12-hour format (01-12)


%M

Minute (00 to 59)


%S

Second (00 to 59)


%p

Characters representing AM/PM (depending on locale)


%P

Characters that represent AM/PM (displayed as AM/PM regardless of locale)


%T

Display milliseconds (000 to 999)


%t

Displays milliseconds with a "." (.001 to .999)


%e

Add the time difference from UTC (+mmss)


%g

Day light saving (Daylight Saving Time) - Adds text (default "DST")


%(H1)

24-hour time (01 to 24) with 1 hour added


%(M1)

The month plus one (01-12). For January it will be 2, for February it will be 3, for December it will be 1.

Advanced formatting

%B

Full month name (January, February etc.)


%b

Abbreviated month name (Jan, Feb etc.)


%A

Full name of the day of the week (Sunday, Monday etc.)


%a

Abbreviated name of the day of the week (Sun, Mon etc.)


%w

Day of the week (0-6) where Sunday is 0


%%

Percent sign (%)


%j

Day of the year (001 to 366)

 

*If you add a # after the % as shown below, the leading 0 will be removed.

  %#d, %#H, %#I, %#j, %#m, %#M, %#S, %#T, %#t, %#w, %#y, %#Y, %(#H1) , %(#M1)

*The following will be ignored even if you add a #.

  %#a, %#A, %#b, %#B, %#p, %#%, %#e, %#s