|XP is just a number|
Re: problem in Rfc2080 date of imap serverby broomduster (Priest)
|on Sep 24, 2008 at 15:14 UTC||Need Help??|
Most of this has been said in one way or another in other replies, but I still sense a bit of confusion, so here goes....
Mail::IMAPClient documentation (and the actual code) say that Rfc2060_datetime returns a date string that is properly formatted for use in various requests to the IMAP server (e.g., delete messages older than N days). It does not report the server's notion of current date and time. The following (untested; I don't have Mail::IMAPClient available to test) should work:
Now $date should be a properly formatted date string for SEARCH, etc. commands to the IMAP server, with the following caveats:
Update: Now that I'm at $HOME, where I have Mail::IMAPClient and can run the above code, it needs a few tweaks and some additional explanation based on re-reading the docs. First the code:
From the shell:
And by way of additional explanation:
The documentation for Mail::IMAPClient->Rfc2060_datetime says:
The timestamp follows the definition of the output of the platforms specific "time", usually in seconds since Jan 1st 1970. However, you have to correct the number yourself for the zone.In other words, if I want the resulting string to give the date/time in my current time zone (EDT, which is GMT-0400), I need to adjust the output of time appropriately. Hence the changes to compute a $zone_correction and adjust $now before calling Mail::IMAPClient->Rfc2060_datetime.