.timestamp("component")

Returns a specific component of a timestamp.

Syntax

timestamp.timestamp("get-year")   // Get year
timestamp.timestamp("get-month")  // Get month
timestamp.timestamp("get-day")    // Get day
timestamp.timestamp("get-hour")   // Get hour
timestamp.timestamp("get-minute") // Get minute
timestamp.timestamp("get-second") // Get second

Parameters

The component parameter can be one of:

  • "get-year": Returns the year (e.g., "2025")

  • "get-month": Returns the month with leading zero (e.g., "01")

  • "get-day": Returns the day with leading zero (e.g., "23")

  • "get-hour": Returns the hour in 24-hour format (e.g., "4")

  • "get-minute": Returns the minute with leading zero (e.g., "51")

  • "get-second": Returns the second with leading zero (e.g., "29")

Returns

A string containing the requested timestamp component.

Example

Important Notes

  • All components are returned as strings

  • Months and days always include leading zeros

  • Hours are in 24-hour format without leading zeros

  • Minutes and seconds always include leading zeros

  • Year is always in full 4-digit format

Last updated

Was this helpful?