Skip to main content

Convert datetime to timestamp

Sophie avatar
Written by Sophie
Updated over a week ago

Definition and Usage

This command transforms a date and time value into a Unix timestamp format. This command allows you to convert datetime values into numeric timestamp representations with different levels of precision.


Parameter Values

Input parameters

Parameter

Description

Possible Values

Required

Options / Notes

Datetime

Enter the datetime value that you want to convert to a timestamp

-

Yes

Accepts datetime variables or text in commonly used formats; defaults to current time if left empty

Time granularity

Select the level of time precision for the timestamp

Seconds, Milliseconds, Microseconds

Yes

Determines the unit of measurement for the timestamp

Error handling

Parameter Name

Description

Throw error & stop

When an error occurs, the action will trigger an error and stop the execution of the entire app.

Retry command

If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process.

Ignore error & continue

When an error occurs, the action will be ignored, and the workflow will continue without interruption.

Variables produced

This action produces a variable that contains the timestamp value in the selected granularity format.


Using Variables in Conditions

You can use the {x} icon to insert variables into the Datetime field. The timestamp output can be used in subsequent actions for time-based calculations, comparisons, or logging operations. When using variables, ensure that the datetime format is compatible with the conversion process.


Notes

  • The timestamp format represents the number of time units (seconds, milliseconds, or microseconds) elapsed since January 1, 1970 (Unix epoch)

  • When using text input for datetime, ensure it follows a standard format (e.g., "YYYY-MM-DD HH:MM:SS") for accurate conversion

  • If an invalid datetime format is provided, the command will return an error

  • Different time granularities will produce timestamps with different digit lengths (seconds: 10 digits, milliseconds: 13 digits, microseconds: 16 digits)

Did this answer your question?