From: arnout at argeweb dot nl
Operating system: Windows 2003 server,standard
PHP version: 5.0.0
PHP Bug Type: COM related
Bug description: conversion between unix timestamp and variant VT_date
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 bug report at http://bugs.php.net/?id=29258&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29258&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29258&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29258&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29258&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29258&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29258&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29258&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29258&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29258&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29258&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29258&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29258&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29258&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29258&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29258&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29258&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29258&r=float