Format Strings for Database Date Values

TestStand 2016 Help

Edition Date: August 2016

Part Number: 370052R-01

»View Product Info
Download Help (Windows Only)

The Format control on the Column/Parameters section of the Database Options dialog box and the Format String control on the Column/Parameter Values section of the Edit Data Operation dialog box support the following format strings when reading date values from a database and writing date values to a database. A format string consists of symbols that describe how to convert a date value read from a database to a string value, or how to interpret a string value when writing a date value to a database.

Format String Value Formatted Value
mm/dd/yy Oct 20, 2010 10/20/10
dd.mm.yy Oct 20, 2010 20.10.10
'Jane Doe, born' Mmmm d, yyyy Oct 20, 2010 Jane Doe, born October 20, 2010
hh:mm:ss 3:47:42 PM 15:47:42
hh:mm:ss AM/PM 3:47:42 PM 03:47:42 PM
Symbol Description Example Output
m Month as number without leading zero. 12, 5
mm Month as number with leading zero when applicable. 12, 05
mmm Month as three-letter abbreviation, lowercase. mar
Mmm Month as three-letter abbreviation, initial cap. Mar
MMM Month as three-letter abbreviation, uppercase. MAR
mmmm Month as full name, lowercase. march
Mmmm Month as full name, initial cap. March
MMMM Month as full name, uppercase. MARCH
d Day of the month as number without leading zero. 25, 5
dd Day of the month as number with leading zero when applicable. 25, 05
ddd Day of the month as three-letter abbreviation, lowercase. tue
Ddd Day of the month as three-letter abbreviation, initial cap. Tue
DDD Day of the month as three-letter abbreviation, uppercase. TUE
dddd Day of the month as full name, lowercase. tuesday
Dddd Day of the month as full name, initial cap. Tuesday
DDDD Day of the month as full name, uppercase. TUESDAY
yy Last two digits of year. 08
yyyy Four-digit year. 2010
h Hour of the day, without leading zero (use am/pm symbol for 12-hour style). 12, 5
hh Hour of the day, with leading zero (use am/pm symbol for 12-hour style). 12, 05
i (or m) Minute of the hour, without leading zero. 57, 5
ii (or mm) Minute of the hour, with leading zero. 57, 05
s Second of the minute, without leading zero. 57, 5
ss Second of the minute, with leading zero. 57, 05
ss.ssssss Second of the minute with fractional seconds (up to six ‘s’ symbols after the decimal point). 57.123456
am/pm "am" or "pm" string, lowercase (forces 12-hour clock). am
AM/PM "AM" or "PM" string, uppercase (forces 12-hour clock). AM
a/p "a" or "p" string (forces 12-hour clock). a
A/P "A" or "P" string, uppercase (forces 12-hour clock). A
/ - . : , <space> Output the character.
\<character> Output the character following the ‘\’ character. \U\T\C is UTC
"<string>"

'<string>'
Output the string. "UTC" is UTC
GD General format for dates is the Short Date Format in the Regional Options section of the Microsoft Windows Control Panel.
Note  Do not combine other format symbols with GD except [US].
GDT General format for dates with times. The Time Format control in the Regional Options section of the Windows Control Panel is appended to the Short Date Style. This is the default when no format string is given.
Note  Do not combine other format symbols with GDT except [US].
GL General long format for dates. The Long Date Style control in the Regional Options section of the Windows Control Panel.
Note  Do not combine other format symbols with GL except [US].
GLT General long format for dates with times. The Time Style control in the Regional Options section of the Windows Control Panel is appended to the Long Date Format.
Note  Do not combine other format symbols with GLT except [US].
GT General format for time. The Time Style control in the Regional Options section of the Windows Control Panel.
Note  Do not combine other format symbols with GT except [US].
[US] Combine with GD, GDT, GL, GLT, or GT to override the Regional Options section of the Windows Control Panel and use the United States defaults instead.

See Also

Database Options dialog box

Edit Data Operation dialog box

WAS THIS ARTICLE HELPFUL?

Not Helpful