Date Time Formats

Date and time formats can be set from the worksheet and from many locations in Grapher. Date and time options are case sensitive. Months always need to be entered with upper case M and minutes must always be entered with lower case m.

When dates are parsed during input/import, the month and day of week names must match those of the local language as set in the Windows Control Panel, otherwise the entry will not be recognized as a valid date and will be treated as a text string.

When the recognized format is ambiguous (i.e. 10/7/12), the month, day, and year order is determined by the Windows locale. In some countries, this will be recognized as M/d/yy, in others as d/M/yy, and in others as YY/M/d. It is important to use non-ambiguous date/time formats when the Windows locale may change.

General Date/Time Formats

These are the general date and time formats. These can be used in the worksheet Format Cells dialog, in the plot window label format section, or from the Date/Time Format Builder dialog. Any combination of these formats can be used in any of these locations.  

Skip to the Predefined Date/Time Formats section for the allowed linked text formats.

All rows below use the date July 9, 2014 at 6:45:44.12345 in the evening for the Example.

Date/Time Code

Example

Description

d

9

Single digit day, excluding leading zero

dd

09

Double digit day, including leading zero

ddd

Wed

Shortened day of week name

dddd

Wednesday

Full day of week name

M

7

Single digit month, excluding leading zero

MM

07

Double digit month, including leading zero

MMM

Jul

Shortened month name

MMMM

July

Full month name

MMMMM

J

First letter of month name

yy

98

Two digit year

yyyy

1998

Full year

g

 

Before Common Era designator - Includes space and bce or nothing if ce, lower case

gg

 ad

BC/AD designator - Includes space and bc or ad, lower case

ggg

 ce

Before Common Era designator - Includes space and bce or ce, lower case

G

 

Before Common Era designator - Includes space and BCE or nothing if CE, upper case

GG

 AD

BC/AD designator - Includes space and BC or AD, upper case

GGG

 CE

Before Common Era designator - Includes space and BCE or CE, upper case

h

6

Single digit hours - 1-12, excluding leading zero

hh

06

Double digit hours - 01-12, including leading zero

H

18

Hours - 0-23 military, excluding leading zero

HH

18

Hours - 00-23 military, including leading zero

[h]

1003914

Hours portion of total time, excludes leading zeros

m

45

Minutes - 0-60, excluding leading zero

mm

45

Minutes - 00 to 60, including leading zero

[mm]

45

Minutes portion of total time, includes leading zeros

ss

44

Seconds - 0-60, rounded to the nearest second

ss.0

44.1

Seconds - 0-60, rounded to the nearest tenth of a second

ss.00

44.12

Seconds - 0-60, rounded to the nearest hundredth of a second

ss.000

44.123

Seconds - 0-60, rounded to the nearest millisecond

ss.0000

44.12345

Seconds - 0-60, maximum precision

[ss]

44

Seconds portion of total time, includes leading zeros

tt

pm

am or pm designator, lower case

TT

PM

AM or PM designator, upper case

\

 

escape character - output next character verbatim

'...'

 

output ALL characters between single quotes verbatim, including escape character

[$-xxxx]

[$-409]

xxxx is an up to four hex digit representation of a locale ID

Predefined Date/Time Formats

The predefined date/time formats are the only formats that can be used inside the linked text brackets <<date/time>> when creating linked text via typing in the Text Editor or automation. You can combine predefined formats by writing separate <<date/time>> fields in the Text Editor or script. For example, you can type <<M/d/yy>> <<h:mm TT>> in the Text Editor to display both time and date.

If you cannot create the desired format by combining predefined date/time formats, consider using the Insert Date/Time button in the Text Editor.

All rows below use the date July 9, 2014 at 6:45:44.12345 in the evening for the Example.

Date/Time Code

Example

Description

M/d/yy

7/9/14

Single digit month, Single digit day, two digit year - separated by forward slash

MM/dd/yy

07/09/14

Two digit month, day, and year - separated with forward slash

MMM dd, yyyy

Jul 09, 2014

Shortened month name, two digit day, four digit year - separated by spaces and a comma

MMMM dd, yyyy

July 09, 2014

Full month name, two digit day, four digit year - separated by spaces and a comma

d-MMM-yy

9-Jul-14

Single digit day, shortened month name, two digit year - separated by hyphens

d-MMM

9-Jul

Single digit day, shortened month name - separated by hyphens

MMM-yy

Jul-14

Shortened month name, two digit year - separated by hyphen

MMM-yyyy

Jul-2014

Shortened month name, four digit year - separated by hyphen

MMMM-yyyy

July-2014

Full month name, four digit year - separated by hyphen

h:mm TT

6:45 PM

clock Hours and minutes with AM/PM designator

h:mm:ss TT

6:45:44 PM

Hours, minutes, and seconds with AM/PM designator

HH:mm

18:45

24-hour clock hours and minutes

HH:mm:ss

18:45:44

24-hour clock hours, minutes, and seconds

M/d/yy HH:mm

7/9/14 18:45

Single digit month, single digit day, two digit year, 24-hour clock hours and minutes

yyyy

2014

Four digit year

yy

14

Two digit year

MMMM

July

Full month name

MMM

Jul

Shortened month name

MM

07

Two digit month

M

7

Single digit month

dddd

Wednesday

Full day name

ddd

Wed

Shortened day name

dd

09

Two digit day

d

9

Single digit day

d/M/yy

9/7/14

Single digit day, single digit month, two digit year - separated by forward slash

dd/MM/yy

09/07/14

Two digit day, two digit month, two digit year - separated by forward slash

yy/MM/dd

14/07/09

Two digit year, two digit month, two digit day - separated by forward slash

yyyy-MM-dd

2014-07-09

Four digit year, two digit month, two digit day - separated by hyphen

See Also

Format Cells - Number Page

Label Format

Date/Time Format Builder

Text Editor