DateTime field

A DateTime field allows a user to enter date and time information in different formats.

Default value can be represented in two different ways:

  • Absolute (fixed time) — When set to fixed time, a user opens up a form which contains this field and its value will be exactly as specified in Fixed Time text-box.
  • relative (interval from now) — When set Time Interval from Now, the default value of the field will be the time a user opens a form plus the interval. For example if you want the default time to be yesterday, enter "-1" into the time interval check box.

Format on the device side — This field defines the format of the date or time, in which the date/time value will appear on the device panel. Drop-down list contains some predefined useful templates.

Table 1. Custom Date and Time Format Strings
Format specifier Description
d Represents the day of the month as a number from 1 through 31. A single-digit day is formatted without a leading zero.
dd Represents the day of the month as a number from 01 through 31. A single-digit day is formatted with a leading zero.
ddd Represents the abbreviated name of the day of the week
dddd (plus any number of additional d specifiers) Represents the full name of the day of the week
f Represents the most significant digit of the seconds fraction; that is, it represents the tenths of a second in a date and time value. If the f format specifier is used without other format specifiers, it is interpreted as the f standard date and time format specifier.
ff Represents the two most significant digits of the seconds fraction; that is, it represents the hundredths of a second in a date and time value.
fff Represents the three most significant digits of the seconds fraction; that is, it represents the milliseconds in a date and time value.
F Represents the most significant digit of the seconds fraction; that is, it represents the tenths of a second in a date and time value. Nothing is displayed if the digit is zero. If the F format specifier is used without other format specifiers, it is interpreted as the F standard date and time format specifier.
FF Represents the two most significant digits of the seconds fraction; that is, it represents the hundredths of a second in a date and time value. However, trailing zeros or two zero digits are not displayed.
FFF Represents the three most significant digits of the seconds fraction; that is, it represents the milliseconds in a date and time value. However, trailing zeros or three zero digits are not displayed.
g, gg (plus any number of additional g specifiers) Represents the period or era, for example, A.D. Formatting ignores this specifier if the date to be formatted does not have an associated period or era string.
h Represents the hour as a number from 1 through 12, that is, the hour as represented by a 12-hour clock that counts the whole hours since midnight or noon. A particular hour after midnight is indistinguishable from the same hour after noon. The hour is not rounded, and a single-digit hour is formatted without a leading zero. For example, given a time of 5:43, this custom format specifier displays "5".
hh, hh (plus any number of additional h specifiers) Represents the hour as a number from 01 through 12, that is, the hour as represented by a 12-hour clock that counts the whole hours since midnight or noon. A particular hour after midnight is indistinguishable from the same hour after noon. The hour is not rounded, and a single-digit hour is formatted with a leading zero. For example, given a time of 5:43, this format specifier displays "05".
H Represents the hour as a number from 0 through 23, that is, the hour as represented by a zero-based 24-hour clock that counts the hours since midnight. A single-digit hour is formatted without a leading zero.
HH, HH (plus any number of additional H specifiers) Represents the hour as a number from 00 through 23, that is, the hour as represented by a zero-based 24-hour clock that counts the hours since midnight. A single-digit hour is formatted with a leading zero.
m Represents the minute as a number from 0 through 59. The minute represents whole minutes that have passed since the last hour. A single-digit minute is formatted without a leading zero.
mm, mm (plus any number of additional m specifiers) Represents the minute as a number from 00 through 59. The minute represents whole minutes that have passed since the last hour. A single-digit minute is formatted with a leading zero.
M Represents the month as a number from 1 through 12. A single-digit month is formatted without a leading zero.
MM Represents the month as a number from 01 through 12. A single-digit month is formatted with a leading zero.
MMM Represents the abbreviated name of the month
MMMM Represents the full name of the month
s Represents the seconds as a number from 0 through 59. The result represents whole seconds that have passed since the last minute. A single-digit second is formatted without a leading zero.
ss, ss (plus any number of additional s specifiers) Represents the seconds as a number from 00 through 59. The result represents whole seconds that have passed since the last minute. A single-digit second is formatted with a leading zero.
t Represents the first character of the AM/PM designator. The AM designator is used if the hour in the time being formatted is less than 12. Otherwise, the PM designator is used.
tt, tt (plus any number of additional t specifiers) Represents the AM/PM designator. The AM designator is used if the hour in the time being formatted is less than 12. Otherwise, the PM designator is used.
y Represents the year as a one or two-digit number. If the year has more than two digits, only the two low-order digits appear in the result. If the first digit of a two-digit year begins with a zero (for example, 2008), the number is formatted without a leading zero.
yy Represents the year as a two-digit number. If the year has more than two digits, only the two low-order digits appear in the result. If the two-digit year has fewer than two significant digits, the number is padded with leading zeros to achieve two digits.
yyy Represents the year with a minimum of three digits. If the year has more than three significant digits, they are included in the result string. If the year has fewer than three digits, the number is padded with leading zeros to achieve three digits.
yyyy Represents the year as a four-digit number. If the year has more than four digits, only the four low-order digits appear in the result. If the year has fewer than four digits, the number is padded with leading zeros to achieve four digits.
yyyyy (plus any number of additional y specifiers) Represents the year as a five-digit number. If the year has more than five digits, only the five low-order digits appear in the result. If the year has fewer than five digits, the number is padded with leading zeros to achieve five digits. If there are additional y specifiers, the number is padded with as many leading zeros as necessary to achieve the number of y specifiers.
: Represents the time separator. This separator is used to differentiate hours, minutes, and seconds.
/ Represents the date separator. This separator is used to differentiate years, months, and days.
" Represents a quoted string (quotation mark). Displays the literal value of any string between two quotation marks (").
' Represents a quoted string (apostrophe). Displays the literal value of any string between two apostrophe (') characters.
%c Represents the result associated with a c custom format specifier, when the custom date and time format string consists solely of that custom format specifier. That is, to use the d, f, F, h, m, s, t, y, z, H, or M custom format specifier by itself, the application should specify %d, %f, %F, %h, %m, %s, %t, %y, %z, %H, or %M.
\c Represents the escape character, and displays the character "c" as a literal when that character is preceded by the escape character (\).
Table 2. Standard Date and Time Format Strings
Format specifier Name Description
d Short date pattern Represents a custom date and time format string "MM/dd/yyyy".
D Long date pattern Represents a custom date and time format string "dddd, dd MMMM yyyy".
f Full date/time pattern (short time) Represents a combination of the long date (D) and short time (t) patterns, separated by a space.
F Full date/time pattern (long time) Represents a custom date and time format string "dddd, dd MMMM yyyy HH:mm:ss".
g General date/time pattern (short time) Represents a combination of the short date (d) and short time (t) patterns, separated by a space.
G General date/time pattern (long time) Represents a combination of the short date (d) and long time (T) patterns, separated by a space.
M, m Month day pattern Represents a custom date and time format string "MMMM dd"
O, o Round-trip date/time pattern Represents a custom date and time format string using a pattern that preserves time zone information. The custom format string is "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK". In this string, the pairs of apostrophes that delimit individual characters, such as the hyphens, the colons, and the letter "T", indicate that the individual character is a literal that cannot be changed. The apostrophes themselves do not appear in the output string. The pattern for this specifier reflects a defined standard (ISO 8601).
R, r RFC1123 pattern The custom format string is "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'".
s Sortable date/time pattern; conforms to ISO 8601 The custom format string is "yyyy'-'MM'-'dd'T'HH':'mm':'ss"
t Short time pattern Represents a custom date and time format string "HH:mm"
T Long time pattern Represents a custom date and time format string "HH:mm:ss"
u Universal sortable date/time pattern Represents a custom date and time format string "yyyy'-'MM'-'dd HH':'mm':'ss'Z'".
U Universal full date/time pattern The pattern is the same as the F pattern. However, formatting operates on the UTC
Y, y Year month pattern Represents a custom date and time format string "yyyy MMMM".