php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29258 conversion between unix timestamp and variant VT_date
Submitted: 2004-07-19 15:19 UTC Modified: 2004-10-26 17:39 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: arnout at argeweb dot nl Assigned:
Status: Closed Package: COM related
PHP Version: 5.0.0 OS: Windows 2003 server,standard
Private report: No CVE-ID: None
 [2004-07-19 15:19 UTC] 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!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-22 14:49 UTC] wez@php.net
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.
 [2004-07-28 09:13 UTC] arnout at argeweb dot nl
Seems to be fixed in CVS. Thanks!
 [2004-10-26 17:11 UTC] norny at yahoo dot com
Was this applied to php 4.3.9? I'm having a similar problem with times after applying some Win2k3 server critical updates.
 [2004-10-26 17:39 UTC] wez@php.net
COM under PHP 4 is not supported any longer.
If you need this feature backported, you either need to write the patch yourself, or throw some $$ at one of the authors of that extension.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC