Click or drag to resize
DateTime conversion
Print this page

By default, time values in tables are assumed to be UTC (Coordinated Universal Time), rather than a local time zone. This is a culture-specific date string followed by the time, expressed using a 12-hour clock.

This topic contains the following sections:

Date/Time conversion

You always have the option to convert a Timestamp value into a preferred string representation, using Windows Date/Time format string specifiers. Whether you must format your time values depends on whether your local data is structured for non-UTC time zones:

  • Taking the default: If you specify no format string, you are accepting the default. As long as your Timestamp values are in UTC and you do not care about the formatting of time values, you do not need to specify any conversion:
    ReportStart(Timestamp)
  • Time zones: If your local file assumes a Timestamp value is expressed in terms of a local time zone, you must explicitly specify both a timestamp format string and a time zone string:
    PurchaseTime(yyyy-MM-dd HH:mm, PST)

Examples:

ReportStart(Timestamp) = "Report start time"           # uses default UTC without formatting
---------------------------------------------------------------------------------------------------
PurchaseTime(yyyy-MM-dd HH:mm) = Input.SwipeTime       # converts and formats UTC to preferred format
---------------------------------------------------------------------------------------------------
RunningTime(hh:mm) = Input.RunTime                     # converts and formats TimeInterval to a string
---------------------------------------------------------------------------------------------------
PurchaseTime(yyyy-MM-dd HH:mm, PST) = Input.SwipeTime  # converts and formats from UTC to time zone
Format for Date/Time strings

To explicitly specify the mapping between a Timestamp or TimeInterval and its string representation, use a Windows Date/Time format string. This can be a simple Format specifier or a custom format string built up from a set of Date/Time format characters and string literals. You may not use a comma as part of a format string.

The following table describes the standard format specifiers for formatting the DateTime values:

SpecifierNameExample
dShort date"8/9/2009"
DLong date"Sunday, August 09, 2009"
fFull date/time - short time"Sunday, August 09, 2009 2:44 PM"
FFull date/time - long time"Sunday, August 09, 2009 2:44:01 PM"
gGeneral date/time - short"8/9/2009 2:44 PM"
GGeneral date/time - long"8/9/2009 2:44:01 PM"
tShort time"2:44 PM"
TLong time"2:44:01 PM"

The following table describes custom date/time format characters:

SpecifierDescription
d The current day of the month as a number between 1 and 31, inclusive. If the day is a single digit only (1-9), then it is displayed as a single digit.
dd The current day of the month as a number between 1 and 31, inclusive. If the day is a single digit only (1-9), it is formatted with a preceding 0 (01-09).
dddThe abbreviated name of the day.
ddddThe full name of the day.
f or FThe most significant digit of the seconds fraction.
h The hour in the range 1-12. If the hour is a single digit (1-9), it is displayed as a single digit.
hh The hour in the range 1-12. If the hour is a single digit (1-9), it is formatted with a preceding 0 (01-09).
H The hour in the range 0-23. If the hour is a single digit (1-9), it is displayed as a single digit.
HH The hour in the range 0-23. If the hour is a single digit (1-9), it is formatted with a preceding 0 (01-09).
m The minute in the range 0-59. If the minute is a single digit (0-9), it is displayed as a single digit.
mm The minute in the range 0-59. If the minute is a single digit (0-9), it is formatted with a preceding 0 (01-09).
M The month, as a number between 1 and 12, inclusive. If the month is a single digit (1-9), it is displayed as a single digit.
MM The month, as a number between 1 and 12, inclusive. If the month is a single digit (1-9), it is formatted with a preceding 0 (01-09).
MMMThe abbreviated name of the month.
MMMMThe full name of the month.
s The seconds in the range 0-59. If the second is a single digit (0-9), it is displayed as a single digit only.
ss The seconds in the range 0-59. If the second is a single digit (0-9), it is formatted with a preceding 0 (01-09).
tThe first character of the A.M./P.M. designator.
ttThe A.M./P.M. designator.
y The year as a one- or two-digit number. The first two digits of the year are omitted. If the year is a single digit (1-9), it is displayed as a single digit.
yy The year as a one- or two-digit number. The first two digits of the year are omitted. If the year is a single digit (1-9), it is formatted with a preceding 0 (01-09).
yyyy The year, including the century. If the year is less than four digits in length, then preceding zeros are appended as necessary to make the displayed year four digits long.
z The time zone offset for the system's current time zone in whole hours only. The offset is always displayed with a leading sign (zero is displayed as "+0"), indicating hours ahead of Greenwich mean time (+) or hours behind Greenwich mean time (-). The range of values is –12 to +13. If the offset is a single digit (0-9), it is displayed as a single digit with the appropriate leading sign.
zz The time zone offset for the system's current time zone in whole hours only. The offset is always displayed with a leading or trailing sign (zero is displayed as "+00"), indicating hours ahead of Greenwich mean time (+) or hours behind Greenwich mean time (-). The range of values is –12 to +13. If the offset is a single digit (0-9), it is formatted with a preceding 0 (01-09) with the appropriate leading sign.
zzz The time zone offset for the system's current time zone in hours and minutes. The offset is always displayed with a leading or trailing sign (zero is displayed as "+00:00"), indicating hours ahead of Greenwich mean time (+) or hours behind Greenwich mean time (-). The range of values is –12:00 to +13:00. If the offset is a single digit (0-9), it is formatted with a preceding 0 (01-09) with the appropriate leading sign.
:Time separator.
/Date separator.
Time zones

The time zone string can be any of the values in the following table:

Tip Tip

Time zone values include the calculation for the offset from UTC standard time as well as any offsets required for daylight savings time. For details, see the TimeZone table documentation.

SpecifierTime ZoneExample location (Continent/City or Country)
ACN-Australia/Adelaide (no Daylight Savings)
ACSAustralian Central Standard TimeAustralia/Adelaide
AEN-Australia/Sydney (no Daylight Savings)
AESAustralian Eastern Standard TimeAustralia/Sydney
AFTAfghanistan TimeAsia/Afghanistan
AKTAlaska Standard TimeAmerica/Anchorage
AMS-Europe/Armenia
ARNArgentinaSouth America/Buenos Aires
ARTArgentina TimeSouth America/Argentina
ASTArizonaAmerica/Phoenix (no Daylight Savings)
ATTAtlantic Standard TimeAltantic
AWSAustralian Western Standard TimeAustralia/Perth
AZTAzerbaijan TimeEurope/Azerbaijan
BDTBangladesh Daylight Time (Bangladesh Daylight saving time keeps UTC+06 offset)Asia/Bangladesh
BOTBolivia TimeSouth America/Bolivia
BRNBrazilAmerica/Fortaleza (no Daylight Savings)
BRTBrazilAmerica/Sao Paulo
BTA-Asia/Brunei
BTTBhutan TimeAsia/Bhutan
CATCentral Africa TimeAfrica/Maputo
CBT-Central America/Cuba
CCTCocos Islands TimeAsia/Cocos Island
CETCentral European TimeEurope/Vienna
CLTChileAmerica/Santiago
CNTChina TimeAsia/Shanghai
COLColombiaAmerica/Bogota
COTColombia TimeSouth America/Colombia
CSTCentral Standard TimeAmerica/Chicago
CVTCape Verde TimeAfrica/Cape Verde
CXTChristmas Island TimeAsia/Christmas Island
EATEast Africa TimeAfrica/Khartoum
ECA-America/Caribbean
ECTEcuador TimeSouth America/Ecuador
EETEastern European TimeEurope/Athens
EGS-North America/Greenland
EITEastern Indonesian TimeAsia/Indonesia
ESTEastern Standard TimeAmerica/New York
FJTFiji TimeOceania/Fiji
FKSFalkland Islands Standard TimeSouth America/Falkland Islands
GILGilbert Island TimePacific/Kiribati
GSS-Europe/Georgia
GSTGulf Standard TimeAsia/Dubai
GYTGuyana TimeSouth America/Guyana
HKTHong Kong TimeAsia/Hong Kong
HMTHeard and McDonald Islands TimeAntarctica/Heard and McDonald Islands
HSTHawaii-Aleutian Standard TimePacific/Honolulu
IOTIndian Ocean TimeAsia/India
IRDIran Daylight TimeAsia/Iran
JSTJapan Standard TimeAsia/Japan
MEXMexicoAmerica/Mexico City
MHTMarshall IslandsOceania/Marshall Islands
MIT-PNG/Manus
MSTMountain Standard TimeAmerica/Denver
MUTMauritius TimeAfrica/Mauritius
MVTMaldives TimeAsia/Maldives
MYTMalaysia TimeAsia/Malaysia
NCTNew Caledonia TimeOceania/New Caledonia
NMTNamibia TimeAfrica/Windhoek
NPTNepal TimeAsia/Nepal
NRT-Pacific/Nauru
NSTNewfoundland Standard TimeAmerica/St. Johns
NUTNiue TimeOceania/Niue
NZTNew Zealand Standard TimePacific/Auckland
PER-South America/Peru
PETPeru TimeAmerica/Lima
PGTPapua New Guinea TimeOceania/Papua New Guinea
PHTPhilippine TimeAsia
PKTPakistan Standard TimeAsia/Pakistan
PNG-Africa/Guinea
PRTPuerto RicoAmerica/Puerto Rico (no Daylight Savings)
PSTPacific Standard TimeAmerica/Los Angeles
PYTParaguay Time (South America)South America/Paraguay
SAM-Oceania/Samoa
SASSouth African Standard TimeAfrica/South Africa
SATSouth African Time Africa/Johannesburg
SBTSolomon Islands TimeOceania/Solomon Islands
SCTSeychelles TimeAfrica/Seychelles
SGTSingapore TimeAntarctica/South Sandwich Islands
SIT-Asia/Singapore
SKTSaskatchewan America/Regina (no Daylight Savings)
SLSSri Lanka Standard TimeAsia/Sri Lanka
SRTSuriname TimeSouth America/Suriname
SSTSaudi Arabia Standard TimeAsia/Riyadh
THAThailand Standard TimeAsia/
TJTTajikistan TimeAsia/Tajikistan
TKTTokelau TimeOceania/TokelauThailand
TMTTurkmenistan TimeAsia/Turkmenistan
TOTTonga TimeOceania/Tonga
TVTTuvalu TimeOceania/Tuvalu
UTCCoordinated Universal TimeEurope/Greenwich
UYSUruguay Summer TimeSouth America/Uruguay
UZTUzbekistan TimeAsia/Uzbekistan
VETVenezuelaAmerica/Caracas
VUTVanuatu TimeOceania/Vanuatu
WATWest Africa TimeAfrica/Lagos
WETWestern European TimeEurope/London