strftime
datetimeFormats a timestamp as a string using a format pattern
Syntax
strftime(timestamp, format) Parameters
timestamp (timestamp) The timestamp to format
format (string) The format string (e.g., "%Y-%m-%d")
Returns
string The formatted date/time string
Examples
Format as ISO date
Input:
strftime("2024-01-15", "%Y-%m-%d") Output:
"2024-01-15" Format with time
Input:
strftime("2024-01-15 14:30:00", "%Y-%m-%d %H:%M:%S") Output:
"2024-01-15 14:30:00" Format with full month name
Input:
strftime("2024-01-15", "%B %d, %Y") Output:
"January 15, 2024" Extract year-month for grouping
Input:
.timestamp | strftime("%Y-%m") Output:
"2024-01" The strftime() function formats a timestamp as a string using strftime format codes. Common codes include %Y (year), %m (month), %d (day), %H (hour), %M (minute), %S (second), %B (full month name), and %A (full weekday name).
Usage
Use strftime() to format dates for display, create custom date strings, group data by time periods, or convert timestamps to specific string formats.