Re: Setting timezone to local timezone
On 2007-01-29, Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx> wrote:
> On Monday, January 29 at 09:03 AM, quoth Stuart McKim:
> > I know that technically the date is correct, but for somebody using
> > an e-mail client that does not automatically convert dates to the
> > local time, such as mutt, it would be nice to show the local time of
> > the sender.
> For DISPLAY of already sent messages, mutt DOES convert the date to
> local time for display in the *index* (it even respects your LC_TIME
> setting), but does NOT convert the date to local time for display when
> viewing the message. As before, when it does convert things, it relies
> on the TZ environment variable.
>
> When you view the message, mutt does very little to obfuscate the
> headers as they appeared in the message. In some cases, it decodes
> them to the correct charset, and removes quotes where appropriate, but
> the rest is essentially unmodified from exactly what was sent.
>
> You could change that yourself by creating a display filter. For
> example:
>
> #!/bin/bash
> # save the message to a file
> cat - > /tmp/timezoneconvert.$$
> # extract the date header
> thedate=$( awk '/^Date: / && !i { $1="" ; print $0 ; i=1}' )
> # convert to the current timezone (defined by TZ)
> thedate=$( date -d "$thedate" )
> # output the modified message
> awk "{ if (/^Date: /) print \"Date: $thedate\"; else print $0; }" \
> </tmp/timezoneconvert.$$
> # clean up
> rm /tmp/timezoneconvert.$$
You can also see the local time at which the message was sent by
setting the 'pager_format' variable, e.g., from my muttrc,
set pager_format="%4C %Z %[!%b %e at %I:%M %p] %.20n %s"
# This format is arranged more
# like the index_format and
# includes the local time at
# which the message was sent.
# Default: "-%Z- %C/%m: %-20.20n %s"
HTH,
Gary
--
Gary Johnson | Agilent Technologies
garyjohn@xxxxxxxxxxxxxxx | Wireless Division
http://www.spocom.com/users/gjohnson/mutt/ | Spokane, Washington, USA