Odd error with time -- are UNIX and Windows timestamps diff?
Posted: Thu Oct 25, 2007 9:13 pm
This is a very simple problem but a little difficult to explain. I think the cause is that I'm running the code on my Windows installation and also on my Linux webhost-- the time is the same but the timestamps (date("U")) are different-- the problem could be that Unix and Windows timestamps are different (if they are..). So is that the cause of the problem?
Here's the problem:
I'm using some time-related code, testing on both my local WAMP server and on my webhost. Running basically the same code to display the time (using an alternate version of date(), my own time_Date() function (seen in this thread-- it is practically the same as date() in usage-- this is irrelevant, but I have the offset at 0 on my local installation's time.php and around 6 hours on my webhost's time.php).
So I'm using this code below to display the time in two formats: a string and a timestamp. For our purposes in this example, time_Date() is exactly the same as date(), so you could assume that date() is being used in the code; I'm 99% sure the function itself is not at fault here.
Running on both servers, the string version of the time is the same but the timestamp is different, seen here:
Server 1 output (my local WAMP installation):
So the times are correct, but the timestamp for the server is two hours ahead of the timestamp of my local installation.
What's the deal?
Here's the problem:
I'm using some time-related code, testing on both my local WAMP server and on my webhost. Running basically the same code to display the time (using an alternate version of date(), my own time_Date() function (seen in this thread-- it is practically the same as date() in usage-- this is irrelevant, but I have the offset at 0 on my local installation's time.php and around 6 hours on my webhost's time.php).
So I'm using this code below to display the time in two formats: a string and a timestamp. For our purposes in this example, time_Date() is exactly the same as date(), so you could assume that date() is being used in the code; I'm 99% sure the function itself is not at fault here.
Code: Select all
print time_Date("F j, Y") . " at " . time_Date("g:i:s a");
print "<BR>" . time_Date("U");Server 1 output (my local WAMP installation):
Code: Select all
October 25, 2007 at 9:05:20 pm
1193364320Code: Select all
October 25, 2007 at 9:05:20 pm
1193371520What's the deal?