Understanding strftime()#
NeoMutt uses the C library function strftime() to format dates and times wherever a date format string is expected — most commonly in $index_format, $date_format, and conditional date expressions.
How NeoMutt Uses strftime()#
In NeoMutt’s format strings, date expandos like %{...}, %[...], and %(...) pass their contents to strftime() for expansion:
Expando |
Meaning |
|---|---|
|
Message date/time converted to the sender’s time zone |
|
Message date/time converted to the local time zone |
|
Date/time when the message was received locally |
The fmt part inside the braces is a strftime() format string.
Common Format Codes#
Code |
Description |
Example |
|---|---|---|
|
Year with century |
|
|
Year without century |
|
|
Month (01–12) |
|
|
Abbreviated month name |
|
|
Full month name |
|
|
Day of month (01–31) |
|
|
Abbreviated weekday name |
|
|
Full weekday name |
|
|
Hour, 24-hour (00–23) |
|
|
Hour, 12-hour (01–12) |
|
|
Minute (00–59) |
|
|
Second (00–60) |
|
|
AM or PM |
|
|
Time zone abbreviation |
|
|
UTC offset |
|
|
ISO 8601 date ( |
|
|
ISO 8601 time ( |
|
|
Locale’s date and time |
|
|
Literal |
|
Examples in NeoMutt#
Setting the date format#
set date_format = "%d/%m/%y %H:%M"
This makes the %d expando in $index_format display dates like 04/04/26 15:07.
Using date expandos in index_format#
set index_format = "%4C %Z %[%b %d %H:%M] %-15.15L %s"
Here %[%b %d %H:%M] formats the message date in the local time zone as Apr 04 15:07.
Combining with conditional dates#
NeoMutt’s conditional date feature uses strftime() codes inside the true/false branches:
set index_format = '%4C %Z %<[d?%[%H:%M]&%[%b %d]> %-15.15L %s'
Today’s messages show the time (15:07), older messages show month and day (Apr 04).
Locale Dependence#
The output of codes like %a, %b, %B, and %c depends on the current locale.
NeoMutt inherits the locale from your environment — the LC_TIME environment variable controls which locale strftime() uses.
Further Reading#
Format Strings — NeoMutt format strings, conditionals, and padding
strftime(3)— Linux man page — Full list of conversion specifiers