Re: Bugs in date-class?
| From: | Michael Wallner | Date: | Wed, 21 Jul 2004 09:19:19 +0000 |
| Subject: | Re: Bugs in date-class? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-13781@lists.php.net to get a copy of this message | ||
Hi Jan Jonas, you wrote:
> Hi,
>
> i think i found an two bug's in your Date-Class or in the Timezone-Class.
>
> This is my PHP-Code:
> echo date("Y-m-d H:i:s")."<br>";
> $date =& new Date();
> $date2 =& new Date();
> $date->isPast($date);
> echo date("Y-m-d H:i:s")."<br>";
>
> And the ouptut is:
> 2004-07-20 16:47:52
> 2004-07-20 14:47:52
>
> I think here is something wrong, because calling the function isPast()
> changes the output of the date-function (which is a php function).
Sorry, that doesn't seem to be a bug... I don't know the internals
of Date but it seems that TZ is changed from UTC to CET, that's all.
IIRC you can take influence on the default TZ by setting
$GLOBALS['_DATE_TIMEZONE_DEFAULT'].
> Next Problem is the result of $date->format("%s"). It should return the
> seconds of a date without a decimal Point, but the result is something
> like this: 13.000000
Just have a look at the source or the API reference, which states:
"%s - seconds including the decimal representation smaller than one second"
HTH
Regards,
--
Michael - < mike(@)php.net >
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc