Date and time format (free format)

<< Click to Display Table of Contents >>

Manual > Appendix > Date and time format >

Date and time format (free format)

About free format

This page explains the specifications regarding the "free format" date and time format.

 

The free format for date and time format is a method of directly specifying the date and time format without using the system format. With the free format, you can set a free format that is not bound by the OS or various settings. The main use of the free format is when you want to specify a special format on an occasional basis. For formats that are commonly used throughout the system, use the system format or user format.

 

 

hint

One restriction of free formatting is that you cannot specify display options such as system formats. (Note: Specifications such as ".D" in @DATETIME or ".D.%HM" are not supported.)

 

 

Free format specifications

 

Format: @[date format]

 

 

■ Date formats that can be specified in free format

 

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 - 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")


%(H0)

0:00 AM is expressed in 24-hour format (24). 1:00 AM onwards is expressed in 24-hour format (01-23)


%(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)

Japanese-only format

%(YJ)

Japanese calendar (Showa 60, Heisei 20, Reiwa 1, etc.)


%(#YJ)

Japanese calendar numbers without the era name at the beginning (60, 20, 1, etc.)


%(AJ)

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


%(aJ)

Abbreviated names of days of the week (Mon, Tue, Wed, etc.)

 

 

*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, %(#H0), %(#H1) , %(#m1)

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

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

 

 

Free format specification example

Display example

@[%Y %m %d %H-%M-%S]

2017 02 18 13-55-42

@[%Y-%m-%d %H-%M-%S]

2017-02-18 13-55-42

@[ABC %Y %m %d %H-%M-%S]

ABC 2017 02 18 13-55-42

@[(%Y %m %d %H:%M)]

(2017 02 18 13:55)

 

*The above examples are just examples. Flexible settings are possible by combining with other date formats.