Bug #1364: Worrying about DateTime Conversion
| From: | holik at kapsch dot net | Date: | Fri, 30 Apr 1999 05:56:04 +0000 |
| Subject: | Bug #1364: Worrying about DateTime Conversion | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5292@lists.php.net to get a copy of this message | ||
From: holik@kapsch.net
Operating system: Win32
PHP version: 3.0.6
PHP Bug Type: Misbehaving function
Bug description: Worrying about DateTime Conversion
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.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net