Define the input format if you are not using the standard locale format as inputstring.

$zd = new Zend_Date($message->date, Zend_Date::RFC_822);

Greetings
Thomas

----- Original Message ----- From: "Taylor Andrew" <[EMAIL PROTECTED]>
To: <fw-general@lists.zend.com>
Sent: Tuesday, November 13, 2007 12:09 PM
Subject: [fw-general] Problems with Zend_Date creating Date objects from Zend_Mail IMAP messages



Hi,

I'm trying to parse dates from a Zend_Mail IMAP message. This code seems
to be the most succinct example:

$zd = new Zend_Date($message->date);
echo $message->date.' = '.$zd->toString('YYYY-MM-dd HH:mm:ss').'<br />';

This simple example outputs the below based on 4 email messages:

4 Nov 2005 11:05:21 -0000 = 2005-04-11 11:05:21
7 Nov 2005 09:41:49 -0000 = 2005-11-07 09:41:49
4 Nov 2005 11:41:56 -0000 = 2005-04-11 11:41:56
7 Nov 2005 09:41:28 -0000 = 2005-11-07 09:41:28

As you can see, to the naked eye it always parses the time element
correctly, the year is also correct, however, on the messages from the
4th of November, it's transposed the month and date elements. This
doesn't occur on the 7th of November. This is a subset of a larger group
of messages, at a quick guess 95% of overall messages are correct. I
could understand it if the initial strings were different (as they can
be with some messages), but, as you can see from the echo of
$message->date in the above examples the formats are matched. Surely
these should all match, or all fail.

Any suggestions as to what's going wrong?

Thanks

Andrew



This email and its attachments are intended for the addressee only and may be confidential or the subject of legal privilege. If this email and its attachments have come to you in error, you must take no action based on them, nor must you copy them, distribute them or show them to anyone. Please contact the sender to notify us of the
error.

Durham City Council accept no liability for, and shall not be legally bound by, the contents of this email. No assurances are given as to the authority of the sender to act on the Council's behalf and the views expressed within this email may not be
official Council policy but instead the personal views of the distributor.

This email and any attached files have been scanned for the presence of computer viruses however, you are advised that Durham City Council bears no liability for attachments and you therefore open any attachments at your own risk.

Reply via email to