Skip to main content Skip to complementary content

Timestamp - script and chart function

TimeStamp() formats an expression as a date and time value, in the timestamp format set in the system variables in the data load script, or in the operating system, unless a format string is supplied.

Syntax:  

Timestamp(number[, format])

Return data type: dual

Arguments
Argument Description
number The number to be formatted.
format

String describing how the resulting timestamp string is to be formatted. If omitted, the short date format, time format, and decimal separator set in the operating system is used.

The Timestamp function supports many format options for different time structures, for example:

DD/MM/YYYY: Focuses on just the date (for example: 15/11/2024).

YYYY-MM-DD hh:mm:ss: ​Displays the full timestamp (for example: 2024-11-15 13:30:45).

​MMM DD, YYYY: ​Displays a short version of the month and the full year (for example: Nov 15, 2024).

hh:mm:ss TT: ​Shows only the time in 12-hour format (for example: 01:30:45 PM)

​HH:mm:ss: ​Displays time in 24-hour format (for example: 13:30:45)

​wwww, MMM DD YYYY: ​Shows full day of the week and date (for example: Friday, Nov 15 2024)

​YYYY-MM-DD hh:mm:ss.fff: ​Includes milliseconds (for example: 2024-11-15 13:30:45.123​).

Descriptions for number and time formats

Example: Chart expressions
Example Result
Timestamp( 35648 ) Returns 97-08-06 00:00:00 when the TimestampFormat is YY-MM-DD hh:mm:ss.
Timestamp(35648,'YYYY-MM-DD hh.mm') Returns 1997-08-06 00.00 when the format supplied is YYYY-MM-DD hh.mm.
Timestamp( 35648,'M/D/YYYY h:mm:ss[.fff] TT') Returns 8/6/1997 12:00:00 AM when the format supplied is M/D/YYYY h:mm:ss[.fff] TT.
Timestamp( 35648,'www, DD MMM YYYY hh:mm TT') Returns Wed, 06 Aug 1997 12:00 AM when the format supplied is www, DD MMM YYYY hh:mm TT.

Example - Timestamp fundamentals

Example - Timestamp fundamentals using a different TimestampFormat setting

Example - Changing the timestamp format of customer orders

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!