Hy,

it depends on your locale setting.
I don't know what your locale setting is, but if you do not give the input format your set locale will be used to determinate the input format.

So I expect that your default date format is something like "YYYY/MM/dd" and Zend_Date tries to automatically correct the failure.
If you switch off the fixation you will see where the problem occurs.

As you said that you are using the mail dateformat as input I expect that all date values correspond to a given format.

I would propose to use Zend_Date as normal and give the input format if it can not be parsed automatically.

Greetings
Thomas


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



Hi,

I'm not sure that would work, as not all messages that I'm seeing match
the specification. On another note; why would this work for one and not
the other:

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

The formats of those strings are identical.

Kind regards

Andrew

-----Original Message-----
From: Thomas Weidner [mailto:[EMAIL PROTECTED]
Sent: 13 November 2007 13:03
To: Taylor Andrew; fw-general@lists.zend.com
Subject: Re: [fw-general] Problems with Zend_Date creating
Date objects from Zend_Mail IMAP messages

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.



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