Skip to main content

format_unix_timestamp

Function format_unix_timestamp 

Source
pub fn format_unix_timestamp(unix_timestamp: i64, pattern: &str) -> String
Expand description

Formats a Unix timestamp using Python-like strftime tokens.

Supported tokens:

  • %Y year with century (e.g. 2026)
  • %m month as zero-padded decimal (01..12)
  • %d day of month as zero-padded decimal (01..31)
  • %H hour (24-hour clock) as zero-padded decimal (00..23)
  • %I hour (12-hour clock) as zero-padded decimal (01..12)
  • %M minute as zero-padded decimal (00..59)
  • %S second as zero-padded decimal (00..59)
  • %p locale-independent AM/PM
  • %% literal %