strflocaltime

datetime

Formats a timestamp in local timezone using a format pattern

Syntax

strflocaltime(timestamp, format)

Parameters

timestamp (timestamp)

The timestamp to format

format (string)

The format string (e.g., "%Y-%m-%d %H:%M:%S %Z")

Returns

string

The formatted date/time string in local timezone

Examples

Format with timezone
Input:
strflocaltime("2024-01-15 14:30:00", "%Y-%m-%d %H:%M:%S %Z")
Output:
"2024-01-15 14:30:00 EST"
Convert to local time
Input:
.timestamp | strflocaltime("%Y-%m-%d %H:%M:%S")
Output:
"2024-01-15 09:30:00"
Human-readable format
Input:
strflocaltime(now(), "%A, %B %d, %Y at %I:%M %p")
Output:
"Monday, January 15, 2024 at 02:30 PM"

The strflocaltime() function formats a timestamp in the local timezone using strftime format codes. Use %Z to include the timezone abbreviation.

Usage

Use strflocaltime() to display timestamps in the user’s local timezone, format dates with timezone information, or convert UTC timestamps to local time for display.