...

View Full Version : Inserting current local date



Fishhead
02-06-2010, 07:20 PM
On a form, I wish to insert the current local date for a user where ever they happen to be. My server's time is set for GMT. I started out using Date(), but found that 4:00 pm in the Pacific time zone, this began returning tomorrow's date.

I replaced this with strftime(), thinking it was suppose to return the local date and time, it also shift one day at 4:00 pm. When I include the time in the strftime() output it clearly is 8 hours later.

What should I be using to obtain the current date (and time) where ever the user is located?

JAY6390
02-06-2010, 07:33 PM
http://www.php.net/manual/en/function.date-default-timezone-set.php

Fishhead
02-06-2010, 08:38 PM
Thanks for the response.

I was looking for a way to detect the local day/time and use it. Your suggestion lets me fix the time zone to different zone than the server time, but not let it be relative to the location of the user.

Or maybe I am missing something in how to use that function.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum