I am getting a unix timestamp back in a database row, which I have to translate into a date to do date/time calculations.
When I run the program under php-gtk in Linux, I get different results than when running it under php-gtk in Windows XP.
Here is the program:
| Code: |
<?php
$Year = 2008;
$Month = 9;
$Day = 30;
$Hour = 16;
$Minute = 00;
$Second = 00;
$TimestampC = mktime( $Hour,$Minute,$Second,$Month,$Day,$Year);
print_r("TimestampC = (" . $TimestampC . ")\n");
print_r("Date from TimestampC = (" . date("Y-m-d H:i:s",$TimestampC) . ")\n");
$TimestampS = 1222790400;
print_r("TimestampS = (" . $TimestampS . ")\n");
print_r("Date from TimestampS = (" . date("Y-m-d H:i:s",$TimestampS) . ")\n");
?>
|
Here is the output from Windows XP, which is clearly not correct
| Code: |
C:\Documents and Settings\sutterp>php W:\gtk2\Example\php\timestamp.php
TimestampC = (1222790400)
Date from TimestampC = (2008-09-30 16:00:00)
TimestampS = (1222790400)
Date from TimestampS = (2008-09-30 16:00:00) |
And here is the one from SuSE Linux,
| Code: |
sutterp@basilisk:~> php /data/www/jjh/intranet/gtk2/Example/php/timestamp.php
TimestampC = (1222761600)
Date from TimestampC = (2008-09-30 16:00:00)
TimestampS = (1222790400)
Date from TimestampS = (2008-10-01 00:00:00)
|
Same program, gets exported via samba share to windows.
I believe that the way SuSE Linux creates the timestamp is correct, 1222790400 is 2008-10-01 00:00:00 and not 2008-09-30 16:00:00. However, its out by 8 hours, which is the timezone difference.
Anybody experiencing similar problems How to fix?
Peter
And why is the board software dishonoring my Carriage Returns once I used the code tag, despite closing it with [\code]?