Skip to main content

Format DateTime

This block is used to format the date and time.

DateTime Format Block

The time_str variable will be set to the formatted date and time.

I'll provide descriptions for common date and time format options:

YYYY: Four-digit year (e.g., 2024) YY: Two-digit year (e.g., 24) MM: Two-digit month (01-12) MMM: Three-letter month abbreviation (e.g., Jan) MMMM: Full month name (e.g., January) DD: Two-digit day of month (01-31) D: Day of month without leading zero (1-31) hh: Two-digit hour in 12-hour format (01-12) HH: Two-digit hour in 24-hour format (00-23) h: Hour in 12-hour format without leading zero (1-12) H: Hour in 24-hour format without leading zero (0-23) mm: Two-digit minutes (00-59) ss: Two-digit seconds (00-59) tt: AM/PM indicator t: A/P indicator

Examples:

  • YYYY-MM-DD: 2024-09-17
  • MM/DD/YYYY: 09/17/2024
  • HH:mm:ss: 14:30:45
  • hh:mm tt: 02:30 PM