.timestamp("convert-date")

Converts a timestamp to various date and time formats.

Syntax

timestamp.timestamp("to-date")     // Convert to date format
timestamp.timestamp("to-time")     // Convert to time format
timestamp.timestamp("to-full")     // Convert to full date and time
timestamp.timestamp("to-relative") // Convert to relative time

Parameters

The format parameter can be one of:

  • "to-date": Returns date in "YYYY-MM-DD" format

  • "to-time": Returns time in "HH:MM:SS" format

  • "to-full": Returns full datetime in "YYYY-MM-DD HH:MM:SS" format

  • "to-relative": Returns relative time (e.g., "8 seconds ago")

Returns

A string containing the formatted date/time.

Example

Important Notes

  • All formats return strings

  • Date format uses leading zeros for month and day

  • Time format uses 24-hour clock with leading zeros

  • Full format combines both date and time

  • Relative format is automatically calculated based on current time

  • Invalid timestamps return appropriate error messages

Last updated

Was this helpful?