Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Getting a client and server to agree on UTC time



Hi Dave.

On 19 December 2010 15:32, Dave M G <dave@example.com> wrote:
> Here's the code I use to get the UTC time on the PHP side.
> $utcTime = time() - date("Z");

Maybe I'm missing your point, but that doesn't give you the current time in UTC.
time() gets you the current time in UTC.
date("Z") gets you the current time in your server's local timezone.
time() - date("Z") gets you the offset between UTC and your server's timezone.

If that is what you're expecting, try renaming your variables so that
their names represent what they're actually supposed to hold, then
post again if you still can't figure out what's going on.

-- 
Edmund Edgar
Founder, KK Social Minds
Educational Technology for the Web and Virtual Worlds

ed@example.com
+81 090 3912 3380
Skype: edmundedgar
Second Life: Edmund Earp
Linked In: edmundedgar
Twitter: @edmundedgar
http://www.socialminds.jp


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links