php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1364 Worrying about DateTime Conversion
Submitted: 1999-04-30 01:56 UTC Modified: 1999-06-20 20:58 UTC
From: holik at kapsch dot net Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.6 OS: Win32
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: holik at kapsch dot net
New email:
PHP Version: OS:

 

 [1999-04-30 01:56 UTC] holik at kapsch dot net
My Timezone is GMT +1, Daylight

Unix Timestamp is Seconds since 1.1.1970

I want to calculate in Days!

One Day has: 60*60*24 Seconds = 86400 Seconds

So for calculating in Days I divide the Unix TimeStamp throu 86400 and cut the rest

But while programming I found a strange behaviour:

  $time = gmmktime(1,0,0,4, 30, 1999);  // 1 hour if Daylight else 0 hours to get a Unix Timestamp 
                                                           // without a Rest if divide throu 86400 in Days 
  $time2 = mktime(2,0,0,4, 30, 1999);  // 1 hour if Daylight else 0 hours + 1 hour GMT +1 for my Timezone
                                                         // to get a Unix Timestamp 
                                                         // without a Rest if divide throu 86400 in Days 
  echo $time."-".$time2."\n";
  echo ($time/86400)."-".($time2/86400)."-".date("YmdHis",$time)."-".date("YmdHis",$time2)."\n";


My Probem is:

1. Why is the Conversion doing such?
2. Not every Country has Daylight, so what can i do if the script should run on a site without daylight
   May I thest every time my scipt for such hidden bugs?

bye Peter.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-20 20:58 UTC] jim at cvs dot php dot net
mktime() will take another parameter to indicate whether
daylight savings time is in effect in the next release.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 08:01:30 2025 UTC