formatTimestamp
Description
Returns a timestamp formatted as a string, with optional control over the output format and time zone.
Syntax
Like many functions in DataPrime, formatTimestamp supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| timestamp | timestamp | true | The timestamp to format |
| format | string | false | The format specification. Defaults to iso8601 |
| tz | string | false | A valid time zone string (see Time Zone section for details) |
Example 1
Print a timestamp with a +5h offset using the default format**
Example query
Example output
Example 2
Use case 2: Print only the year and month
Example query
Example output
Example 3
Use case 3: Print only the hours and minutes
Example query
Example output
Example 4
Use case 4: Print a timestamp in milliseconds (13 digits)
Example query
Example output
Theme
Light