Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the right time for my location 1

Status
Not open for further replies.

JillC

Technical User
Jan 10, 2001
241
AU
I have a form to email script which produces the following line in the output emails:

Here are the results from a form submission on [output type="date" format="F j, Y, g:i a"]

The trouble is the server is 2 hours ahead of local time. Is there any way I can adjust the time?
 
if you are using php >=5.1 then include this at the top of your script

Code:
date_default_timezone_set ("Europe/Lisbon");
(as an example to set the timezone to Lisbon time.)

Code:
putenv("TZ=Europe/Lisbon");

this will shift the timezone of all subsequent time/date commands within your script.

a list of permitted timezones is found here:
 
then you are not using php >= 5.1.0 and you will need either to upgrade or to use the second method i provided
 
Oh, I hadn't understood. I thought that was 2 lines of code. I put both in.

Now that I've pulled out the first line and just left the second code, it worked! Thanks very much.
 
you're right, i had missed out the "or, if not:" between the two lines of code
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top