2008年8月1日星期五

[fw-mvc] Zend_Date creates wrong date

Hello,

I'm having trouble creating certain dates with Zend_Date. If I set the month to 3 (March) or later, and set the hour to 22 (10:00 pm) or later, the "day" gets incremented by 1.

I am using the latest trunk (svn rev. 10601). Am I doing something wrong? I didn't see any open issues about this in JIRA.

Here is a snippet of code to reproduce the incorrect date.

<?php

date_default_timezone_set('America/Los_Angeles');

// This works fine
$dateArray = array(
    'month'     => 8,
    'day'       => 7,
    'year'      => 2008,
    'hour'      => 21
);
$date = new Zend_Date($dateArray);
echo $date; // outputs "Aug 7, 2008 9:00:00 PM"

// This outputs wrong date
$dateArray = array(
    'month'     => 8,
    'day'       => 7,
    'year'      => 2008,
   
'hour'      => 22
);
$date = new Zend_Date($dateArray);
echo $date; // outputs "Aug
8, 2008 10:00:00 PM"

?>

没有评论: