[MlMt] Mail Date and UTC

Benny Kjær Nielsen mailinglist at freron.com
Wed Sep 24 04:25:00 EDT 2014


On 23 Sep 2014, at 15:35, Alexander Kucera wrote:

> I have a test email whose raw headers show the date as `Date: Tue, 23 
> Sep 2014 13:03:13 +0000` which is what is written into the variable I 
> get from MailMate. However I live in UTC+2 so the time I should be 
> putting into the log is `15:03:13`.
>
> MailMate displays this correctly in the UI, but passes the raw time 
> value to the bundle, which is fine I guess, but I am unable to convert 
> in in any way that makes sense due to a lack of Ruby/programming 
> knowledge.
>
> A little help please?

You should pass the virtual `#date` value instead of the raw date of the 
message. That way you'll leave it to MailMate to generate a canonically 
formatted date instead of the numerous badly formatted dates used in 
emails.

After that, you can probably make Ruby parse it and format it in any way 
you like (I haven't checked how this works in Ruby). On the command 
line, you can do it like this:

	date -j -f "%Y-%m-%d %T %z" "2014-01-01 10:10:10 +0000" "+%a %b %d %T 
%Y"

The format strings are described in `man strftime`.

-- 
Benny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freron.com/pipermail/mailmate/attachments/20140924/5c12361a/attachment.html>


More information about the mailmate mailing list