Details
Description
For Zend_Dates in a timezone other than UTC, getDate() doesn't return a date with 0 time part, as described in docu, but instead 0 + time zone base offset (without DST).
I don't know if this is intended or not. If it is, it should be documented in the documentation.
Example of when this is a problem:
You have a set of objects and want to select only those whose time property is today. So you filter using (time >= Zend_Date::now()- >getDate()->getTimestamp() && time < ...). But this will not display what the user considers "today" (what is today in the current timezone).
Example:
$ php
<?php
require_once 'Zend/Date.php';
date_default_timezone_set('Europe/Ljubljana');
$date = Zend_Date::now();
echo $date.PHP_EOL;
echo $date->getDate().PHP_EOL;
Oct 5, 2008 11:29:00 AM
Oct 5, 2008 1:00:00 AM
Given the docu (Returns a clone of $this, with the time part set to 00:00:00.), I would expect it to work the same as this:
$ php <?php require_once 'Zend/Date.php'; date_default_timezone_set('Europe/Ljubljana'); $date = Zend_Date::now(); echo $date.PHP_EOL; $date->set(0, 'HOUR'); $date->set(0, 'MINUTE'); $date->set(0, 'SECOND'); $date->set(0, 'MILLISECOND'); echo $date.PHP_EOL; Oct 5, 2008 11:48:53 AM Oct 5, 2008 12:00:00 AM$ php <?php require_once 'Zend/Date.php'; date_default_timezone_set('Europe/Ljubljana'); $date = Zend_Date::now(); echo $date.PHP_EOL; $date->set(0, 'HOUR'); $date->set(0, 'MINUTE'); $date->set(0, 'SECOND'); $date->set(0, 'MILLISECOND'); echo $date.PHP_EOL; Oct 5, 2008 11:48:53 AM Oct 5, 2008 12:00:00 AM