#29258 [Opn->Fbk]: conversion between unix timestamp and variant VT_date
| From: | wez@php.net | Date: | Thu, 22 Jul 2004 12:49:15 +0000 |
| Subject: | #29258 [Opn->Fbk]: conversion between unix timestamp and variant VT_date | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-63343@lists.php.net to get a copy of this message | ||
ID: 29258
Updated by: wez@php.net
Reported By: arnout at argeweb dot nl
-Status: Open
+Status: Feedback
Bug Type: COM related
Operating System: Windows 2003 server,standard
PHP Version: 5.0.0
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Please try a snapshot.
Previous Comments:
------------------------------------------------------------------------
[2004-07-19 15:19:43] arnout at argeweb dot nl
Description:
------------
Converting dates using variant_date_from_timestamp() loses 2 hours.
Might be some timezone-like thing but then again:
variant_date_to_timestamp() does give a precise translation.
I'm running apache 2 with php 5.0.0 RC 2. I tried both CGI and through
apache.
Reproduce code:
---------------
<?
$nu = date('Ymd');
echo "now: $nu\n";
$timestamp = mktime( 0, 0, 0, date('m'), date('d'), date('Y') ); //
Ymd = 2004 07 19
echo "now timestamp: $timestamp\n";
echo "a.k.a. : ".$timestamp." = ".date('Ymd', $timestamp
)."\n";
$variant = variant_date_from_timestamp( $timestamp );
//$variant = variant_date_from_timestamp( time() );
echo "variant: ".$variant."\n";
$var_timestamp = variant_date_to_timestamp( $variant );
echo "and back again: ".$var_timestamp." = ".date('Ymd',
$var_timestamp
)."\n";
?>
Expected result:
----------------
now: 20040719
now timestamp: 1090188000
a.k.a. : 1090188000 = 20040719
variant: 19-7-2004 0:00:00
and back again: 1090188000 = 20040719
Actual result:
--------------
now: 20040719
now timestamp: 1090188000
a.k.a. : 1090188000 = 20040719
variant: 18-7-2004 22:00:00
and back again: 1090180800 = 20040718
// 2 hours gone! And even worse: The date changed!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29258&edit=1