Skip To Content

Format date and time dynamic text

There are a variety of date and time formats that can be used independently or in combination to control how dates and time display as dynamic text. These formats can be used for any date- or time-related dynamic text tag, such as date saved or current time. If used in combination, any spaces used to separate each format element will appear in the output string on the page. The format syntax is case sensitive. Characters in the format string enclosed in single quotation marks appear in the same location and unchanged in the output string.

  1. To insert dynamic text on a layout, on the Insert tab, in the Text group, click the Dynamic Text drop-down menu Add Dynamic Text and under Map Frame - Time, choose Current Time.
  2. In the layout view, click and drag a box in the desired location to create the dynamic text element.

    The dynamic text element is added to the layout.

  3. In the Format Text pane, under Text, look at the syntax. In the format attribute, the text to the left of the vertical bar controls the date format, and the text to the right controls the time format.

    In the Format Text pane, the text will appear as follows:

    Current Time <dyn type="mapFrame" name="Map Frame Name" property="time" format="short|short"/>.

    On the page, the text will appear as follows:

    Current Time 7/31/2004 1:57 AM to 12/6/2007 3:15 PM

    Note:

    If the Format Text pane is not open, right-click the dynamic text element in the Contents pane and choose Properties to open the pane.

  4. Update the date and time formats using the options in the tables in the following section.

    For example, in the Format Text pane, the text appears as follows:

    Current Time <dyn type="mapFrame" name="Map Frame Name" property="time" format="long|H:mm"/>.

    On the page, the text will appear as follows:

    Current Time Saturday, July 31, 2004 1:57 to Thursday, December 06, 2007 15:15

  5. To display only the date, remove the vertical bar and include only a date format.

    For example, in the Format Text pane, the text will appear as follows:

    Current Time <dyn type="mapFrame" name="Map Frame Name" property="time" format="short"/>.

    On the page, the text will appear as follows:

    Current Time 7/31/2004 to 12/6/2007

  6. To display only the time, remove the date format and include the vertical bar and a time format.

    For example, in the Format Text pane, the text will appear as follows:

    Current Time <dyn type="mapFrame" name="Map Frame Name" property="time" format="|h:mm:ss tt"/>.

    On the page, the text will appear as follows:

    Current time 1:57:33 AM to 3:15:55 PM

Dynamic text tags

Date formats

FormatDescriptionExample syntaxExample output

empty

Month, day, and year as digits with no leading zero for single-digit days.

<dyn type="date" format=""/>

9/7/2009

short

Month, day, and year as digits with no leading zero for single-digit days.

<dyn type="date" format="short"/>

9/7/2009

long

Month and day as text with year.

<dyn type="date" format="long"/>

Thursday, September 7, 2009

month

Month as text with year.

<dyn type="date" format="month"/>

September, 2009

d

Day of month as digits with no leading zero for single-digit days.

<dyn type="date" format="d"/>

7

dd

Day of month as digits with leading zero for single-digit days.

<dyn type="date" format="dd"/>

07

ddd

Day of week as a three-letter abbreviation. The function uses the LOCALE_SABBREVDAYNAME value associated with the specified locale.

<dyn type="date" format="ddd"/>

Thu

dddd

Day of week as its full name. The function uses the LOCALE_SDAYNAME value associated with the specified locale.

<dyn type="date" format="dddd"/>

Thursday

M

Month as digits with no leading zero for single-digit months.

<dyn type="date" format="M"/>

9

MM

Month as digits with leading zero for single-digit months.

<dyn type="date" format="MM"/>

09

MMM

Month as a three-letter abbreviation. The function uses the LOCALE_SABBREVMONTHNAME value associated with the specified locale.

<dyn type="date" format="MMM"/>

Sep

MMMM

Month as its full name. The function uses the LOCALE_SMONTHNAME value associated with the specified locale.

<dyn type="date" format="MMMM"/>

September

y

Year as last two digits, but with no leading zero for years less than 10.

<dyn type="date" format="y"/>

9

yy

Year as last two digits, but with leading zero for years less than 10.

<dyn type="date" format="yy"/>

09

yyy or yyyy

Year represented by full four or five digits, depending on the calendar used. Thai Buddhist and Korean calendars both have five-digit years. The yyyy pattern will show five digits for these two calendars and four digits for all other supported calendars.

<dyn type="date" format="yyy"/>

2009

gg

Period/Era string. The function uses the CAL_SERASTRING value associated with the specified locale. This element is ignored if the date to be formatted does not have an associated era or period string.

<dyn type="date" format="gg"/>

A.D.

Time formats

FormatDescriptionExample syntaxExample output

empty

Hour, minutes, and seconds with no leading zero for single-digit hours; 12-hour clock.

<dyn type="time" format=""/>

3:04:09 PM

short

Hour and minutes with no leading zero for single-digit hours; 12-hour clock.

<dyn type="time" format="short"/>

3:04 PM

long

Hour, minutes, and seconds with no leading zero for single-digit hours; 12-hour clock.

<dyn type="time" format="long"/>

3:04:09 PM

h

Hour with no leading zero for single-digit hours; 12-hour clock.

<dyn type="time" format="h"/>

3

H

Hour with no leading zero for single-digit hours; 24-hour clock.

<dyn type="time" format="H"/>

15

hh

Hours with leading zero for single-digit hours; 12-hour clock.

<dyn type="time" format="hh"/>

03

HH

Hours with leading zero for single-digit hours; 24-hour clock.

<dyn type="time" format="HH"/>

15

m

Minutes with no leading zero for single-digit minutes.

<dyn type="time" format="m"/>

4

mm

Minutes with leading zero for single-digit minutes.

<dyn type="time" format="mm"/>

04

s

Seconds with no leading zero for single-digit seconds.

<dyn type="time" format="s"/>

9

ss

Seconds with leading zero for single-digit seconds.

<dyn type="time" format="ss"/>

09

t

One-character time marker string, such as A or P.

<dyn type="time" format="t"/>

P

tt

Multicharacter time marker string, such as AM or PM.

<dyn type="time" format="tt"/>

PM

Related topics

In this topic
  1. Dynamic text tags