2008年9月3日星期三

Re: [fw-mvc] Zend_Date issue

Can you please explain the logic behind how that specific date is chosen as the output when the invalid time stamp 0000-00-00 00:00:00 is passed to Zend_Date?

Also, I would argue that a time stamp 0000-00-00 00:00:00 is technically valid as this is what is output from the database in the event that the database admin set this value as the default on insert.  Is there a database best practice I am missing, perhaps?  Could there be a mechanism created whereby Zend_Date would simply output 0000-00-00 00:00:00 if that is passed to it?  This would keep me from having to code this logic:

if($LastLoginDate == '0000-00-00 00:00:00'){
$lastLoginDateFinal = 'Not Recorded';
}
else{
$lastLoginDateLocalized = new Zend_Date($LastLoginDate);
$lastLoginDateFinal = $lastLoginDateLocalized->toString();
}

Paul Shoemaker | LAMP Developer
paul.shoemaker@helloecho.com

echo  |  Hello. Hello.  |  helloecho.com

The information contained in this message is intended only for the use
of the individual or entity named above. If the reader of this message
is not the intended recipient, or the employee or agent responsible for
delivering it to the intended recipient, you are hereby notified that
any dissemination, distribution, or copying of this communication is
strictly prohibited.

On Sep 3, 2008, at 10:26 AM, Thomas Weidner wrote:

Have you ever heard of the month 0 ???
Me not, and Zend_Date also not.

That's the reason why Zend_Date automatically fixes this wrong date.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com

----- Original Message -----
From: "Paul Shoemaker" <paul.shoemaker@helloecho.com>
To: <fw-mvc@lists.zend.com>
Sent: Wednesday, September 03, 2008 5:17 PM
Subject: [fw-mvc] Zend_Date issue


> Hello,
>
> Can anyone verify that they are experiencing this issue?  When I 
> initialized a Zend_Date object with the following:
>
> $date = new Zend_Date('0000-00-00 00:00:00');
>
> and then output the string value with:
>
> $date->toString();
>
> I receive the following output(via var_dump):
>
> string 'Nov 30, 00-1 12:00:00 AM' (length=24)
>
> Anyone know what is happening here?  Here is the output from var_dump 
> of the object:
>
> object(Zend_Date)[75]
>   private '_Locale' =>
>     object(Zend_Locale)[72]
>       private '_Locale' => string 'en_US' (length=5)
>       private '_Codeset' => null
>   private '_Fractional' => int 0
>   private '_Precision' => int 3
>   private '_unixTimestamp' => string '-62170135200' (length=12)
>   private '_timezone' => string 'America/Chicago' (length=15)
>   private '_offset' => int 21600
>   private '_syncronised' => int 0
>   protected '_dst' => boolean true
>
>
> Paul Shoemaker | LAMP Developer
> paul.shoemaker@helloecho.com
>
> echo  |  Hello. Hello.  |  helloecho.com
>
> The information contained in this message is intended only for the use
> of the individual or entity named above. If the reader of this message
> is not the intended recipient, or the employee or agent responsible for
> delivering it to the intended recipient, you are hereby notified that
> any dissemination, distribution, or copying of this communication is
> strictly prohibited.


没有评论: