Using the MH date2local function
By mkupfer on Oct 01, 2008
Bill Janssen recently suggested on the MH-E developers list a different format for showing the contents of a folder. Normally MH-E just shows the month and day, e.g., 09/17, for the date. One of Bill's suggestions was that if the message is less than a day old, MH-E could show the time instead, e.g., 13:45.
I've been happy just seeing the date, but I could see how showing the time might be useful. I did have one concern, which was whether MH (which is what MH-E runs on top of) would use the message's timezone or my local timezone. I routinely get email from all over the USA, plus the United Kingdom, China, India, Australia, and Japan. To get an accurate sense of when the emails were sent--for the timestamps to be useful--I'd want to see them all in my timezone.
Unfortunately, some experimentation showed me that Bill's patch used the sender's timezone.
But poking around in the
mh-format man page
date2local function that would convert the
displayed time to my local timezone. Ah, just what I wanted.
I first tried using it in something like
but that produced error messages. Looking more closely at the
man page showed me that
date2local works by
side-effect; it doesn't return an updated date string. Okay, so
how do you use it? I couldn't figure it out from the man page,
and Googling for
date2local didn't show any usage
But I did get some Google hits that reminded me of the sample format files that typically ship with MH. After staring at them for a bit, I tried
and that worked.