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 Name | Description | Example Values |
---|---|---|
None | No format applied. Values will be sent to the client as is, and displayed according to the system defaults. | N/A |
General Date | Displays 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 Date | Displays a date according to your system's long date format. | August 1, 2015 Monday August 1, 2015 |
Medium Date | Displays a date using the medium date format appropriate for the language version of the host application. | Aug 01, 2015 |
Short Date | Displays a date using your system's short date format. | 8/1/15 8/01/2015 |
Long Time | Displays a time using your system's long time format; includes hours, minutes, and seconds. | 12:00:00 AM 12:00:00 AM PDT |
Medium Time | Displays a time in the 12-hour format using hours and minutes and the AM/PM designator. | 12:00:00 AM |
Short Time | Displays 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.
Character | Description |
---|---|
: | 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. |
C | Displays 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. |
d | Displays the day as a number without a leading zero (1-31). |
dd | Displays the day as a number with a leading zero (01-31). |
ddd | Displays the day as an abbreviation (Sun-Sat). |
dddd | Displays the day as a full name (Sunday-Saturday). |
ddddd | Displays the date as a complete date (including day, month, and year), formatted according to your system's short date format setting. |
dddddd | Displays 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. |
w | Displays the day of the week as a number (1 for Sunday through 7 for Saturday). |
ww | Displays the week of the year as a number (1-54). |
M | Displays the month as a number without a leading zero (1-12). |
MM | Displays the month as a number with a leading zero (01-12). |
MMM | Displays the month as an abbreviation (Jan-Dec). |
MMMM | Displays the month as a full month name (January-December). |
q | Displays the quarter of the year as a number (1-4). |
y | Displays the day of the year as a number (1-366). |
yy | Displays the year as a two-digit number (00-99). |
yyyy | Displays the year as a four-digit number (100-9999). |
H | Displays the hour as a number without leading zeros (0-23). |
HH | Displays the hour as a number with leading zeros (00-23). |
h | Displays clock-hour-of-am-pm without leading zeros. |
hh | Displays clock-hour-of-am-pm (1-12) with leading zeros. |
n or m | Displays the minute as a number without leading zeros (0-59). |
nn or mm | Displays the minute as a number with leading zeros (00-59). |
s | Displays the second as a number without leading zeros (0-59). |
ss | Displays the second as a number with leading zeros (00-59). |
ttttt | Displays 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/PM | Displays 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/pm | Displays 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/P | Displays 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/p | Displays 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. |
AMPM | Displays 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. |