Skip to content
  • There are no suggestions because the search field is empty.

Date Time Format Strings

[PDF version here]

The following datetime format strings can be used as when creating timestamp format strings in products like LGH File Inspector, OPC Data Logger, or our OPC Data Client development toolkit - that allow custom timestamp formats to be specified.

Format specifier Description Output Example
Example: 2020-06-01T13:09:02.6175425
d The day of the month, from 1 through 31. 1
dd The day of the month, from 01 through 31. 01
ddd The abbreviated name of the day of the week. Mon (en-US)
dddd The full name of the day of the week. Monday (en-US)
f The tenths of a second in a date and time value. 6
ff The hundredths of a second in a date and time value. 61
fff The milliseconds in a date and time value. 617
ffff The ten thousandths of a second in a date and time value. 6175
fffff The hundred thousandths of a second in a date and time value. 61754
ffffff The millionths of a second in a date and time value. 617542
fffffff The ten millionths of a second in a date and time value. 6175425
F If non-zero, the tenths of a second in a date and time value. 6
FF If non-zero, the hundredths of a second in a date and time value. 61
FFF If non-zero, the milliseconds in a date and time value. 617
FFFF If non-zero, the ten thousandths of a second in a date and time value. 5275
FFFFF If non-zero, the hundred thousandths of a second in a date and time value. 61754
FFFFFF If non-zero, the millionths of a second in a date and time value. 617542
FFFFFFF If non-zero, the ten millionths of a second in a date and time value. 6175425
g, gg The period or era. A.D.
h The hour, using a 12-hour clock from 1 to 12. 1
hh The hour, using a 12-hour clock from 01 to 12. 01
H The hour, using a 24-hour clock from 0 to 23. 13
HH The hour, using a 24-hour clock from 00 to 23. 13
K Time zone information. -07:00 (depends on local computer settings)
m The minute, from 0 through 59. 9
mm The minute, from 00 through 59. 09
M The month, from 1 through 12. 6
MM The month, from 01 through 12. 06
MMM The abbreviated name of the month. Jun (en-US)
MMMM The full name of the month. June (en-US)
s The second, from 0 through 59. 2
ss The second, from 00 through 59. 02
t The first character of the AM/PM designator. (en-US)
tt The AM/PM designator. PM (en-US)
Example: 0001-01-01T00:00:00
y The year, from 0 to 99. 1
yy The year, from 00 to 99. 01
yyy The year, with a minimum of three digits. 001
yyyy The year as a four-digit number. 0001
yyyyy The year as a five-digit number. 00001
Example: 2020-06-15T13:45:30-07:00
z Hours offset from UTC, with no leading zeros. -7
zz Hours offset from UTC, with a leading zero for a single-digit value. -07
zzz Hours and minutes offset from UTC. -07:00
: The time separator. (en-US)
/ The date separator. (en-US)
"string" Literal string delimiter. "arr:" h:m t ⇒ "arr:" 1:45 P
'string' More information: Character literals 'arr:' h:m t ⇒ 'arr:' 1:45 P
% Defines the following character as a custom format specifier. %h ⇒ 1
\ The escape character. h \h ⇒ 1 h
Any other character The character is copied to the result string unchanged. arr hh:mm t ⇒ arr 01:45 A