Skip to main content
Version: Next

Date and Time Format Strings

You can specify how values are formatted for attributes of DATETIME or DATE data types.

Built-in Date and Time Formats

Format NameDescriptionExample Values
NoneNo format applied. Values will be sent to the client as is, and displayed according to the system defaults.N/A
General DateDisplays a date and/or time. For real numbers, displays a date and time, for example, 4/3/93 05:34 PM. If there is no fractional part, displays only a date, for example, 4/3/93. If there is no integer part, displays a time only, for example, 05:34 PM. The format of the date display is determined by your system settings.08/01/2015 00:00 AM August 1, 2015 Monday August 1, 2015
Long DateDisplays a date according to your system's long date format.August 1, 2015 Monday August 1, 2015
Medium DateDisplays a date using the medium date format appropriate for the language version of the host application.Aug 01, 2015
Short DateDisplays a date using your system's short date format.8/1/15 8/01/2015
Long TimeDisplays a time using your system's long time format; includes hours, minutes, and seconds.12:00:00 AM 12:00:00 AM PDT
Medium TimeDisplays a time in the 12-hour format using hours and minutes and the AM/PM designator.12:00:00 AM
Short TimeDisplays a time using the 24-hour format, for example, 17:45.12:00 AM

Custom Date and Time Formats

If you choose Custom as the format, you can supply a format string to specify how to format date and time values.

The following table identifies the characters that can appear in the format string for date and time values.

CharacterDescription
:Represents a time separator that separates hours, minutes, and seconds when time values are formatted. The actual character used as the time separator in formatted output is determined by the system settings of the computer. Note: In some locales, other characters may used as the time separator.
/Represents a date separator that separates the day, month, and year when date values are formatted. The actual character used as the date separator in formatted output is determined by the system settings of the computer. Note: In some locales, other characters may be used to represent the date separator.
CDisplays the date as ddddd and displays the time as ttttt, in that order. Displays only date information if there is no fractional part to the date serial number. Displays only time information if there is no integer portion.
dDisplays the day as a number without a leading zero (1-31).
ddDisplays the day as a number with a leading zero (01-31).
dddDisplays the day as an abbreviation (Sun-Sat).
ddddDisplays the day as a full name (Sunday-Saturday).
dddddDisplays the date as a complete date (including day, month, and year), formatted according to your system's short date format setting.
ddddddDisplays a date serial number as a complete date (including day, month, and year), formatted according to the long date setting recognized by the computer system.
wDisplays the day of the week as a number (1 for Sunday through 7 for Saturday).
wwDisplays the week of the year as a number (1-54).
MDisplays the month as a number without a leading zero (1-12).
MMDisplays the month as a number with a leading zero (01-12).
MMMDisplays the month as an abbreviation (Jan-Dec).
MMMMDisplays the month as a full month name (January-December).
qDisplays the quarter of the year as a number (1-4).
yDisplays the day of the year as a number (1-366).
yyDisplays the year as a two-digit number (00-99).
yyyyDisplays the year as a four-digit number (100-9999).
HDisplays the hour as a number without leading zeros (0-23).
HHDisplays the hour as a number with leading zeros (00-23).
hDisplays clock-hour-of-am-pm without leading zeros.
hhDisplays clock-hour-of-am-pm (1-12) with leading zeros.
n or mDisplays the minute as a number without leading zeros (0-59).
nn or mmDisplays the minute as a number with leading zeros (00-59).
sDisplays the second as a number without leading zeros (0-59).
ssDisplays the second as a number with leading zeros (00-59).
tttttDisplays a time as a complete time (including hour, minute, and second), formatted using the time separator defined by the time format recognized by the computer system. A leading zero is displayed if the leading zero option is selected, and the time is earlier than 10:00 in either the A.M. or the P.M. cycle. For example, 09:59.
AM/PMDisplays an uppercase AM with any hour from midnight until noon; displays an uppercase PM with any hour from noon until midnight. Note: Uses the 12-hour clock.
am/pmDisplays a lowercase am with any hour from midnight until noon; displays a lowercase pm with any hour from noon until midnight. Note: Uses the 12-hour clock.
A/PDisplays an uppercase A with any hour from midnight until noon; displays an uppercase P with any hour from noon until midnight. Note: Uses the 12-hour clock.
a/pDisplays a lowercase a with any hour from midnight until noon; displays a lowercase p with any hour from noon until midnight. Note: Uses the 12-hour clock.
AMPMDisplays the AM string literal as defined by the computer system with any hour from midnight until noon; displays the PM string literal as defined by the computer system with any hour from noon until midnight. AMPM can be either uppercase or lowercase, but the case of the string displayed matches the string as defined by the system settings of the computer. Note: Uses the 12-hour clock.