Timestamp#() evaluates
an expression as a date and
time value, in the timestamp format set in the data load script or the operating system, unless a format string is supplied.
Syntax:
timestamp#(text[,
format])
Return data type: dual
Arguments
Argument
Description
text
The text string to be evaluated.
format
String describing the format of the text string to be evaluated. If omitted, the short date format, time format, and decimal separator set in the operating system
is used. ISO 8601 is supported for timestamps.
Load the data and open a sheet. Create a new table and add this field as a dimension:
OrderDate
Create the following measures:
=Timestamp#(OrderDate, 'YYYY-MM-DD hh:mm'), to convert the OrderDate field from text to a timestamp.
=Sum(Sales), to calculate the sales value.
Results table
OrderDate
Timestamp#(OrderDate, 'YYYY-MM-DD hh:mm')
Sum(Sales)
2023-10-01 10:30
2023-10-01 10:30
100
2023-10-01 14:45
2023-10-01 14:45
150
2023-10-02 09:00
2023-10-02 09:00
200
2023-10-03 16:20
2023-10-03 16:20
300
In this example, the Timestamp# function has converted the OrderDate field from a string, which was left-aligned, to a timestamp (number), which is now right-aligned.
The following load script uses the date format M/D/YYYY. The date format is specified in the SET DateFormat statement at the beginning of the load script.