PDA

View Full Version : PHP date and time


chode
03-23-2009, 12:20 PM
Hey everyone,

I recently added a form to my contacts page which just fires off an email when submitted. All is good except that date and time are set to EST. I didn't code this particular part myself so Im not sure how to change it to Australian eastern standard or daylight time (AEST/AEDT).

Here's the particular code

$todayis = date("l, F j, Y, g:i a") ;

Any help appreciated.

Cheers

davidj
03-23-2009, 01:45 PM
whats the format your trying to produce

chode
03-23-2009, 10:31 PM
Hi mate, this is how its appearing in the email

Monday, March 23, 2009, 3:13 am [EST]

chode
03-24-2009, 01:02 AM
I figured it out. For anyone else whoever comes across this problem you need to make sure firstly that this line of code exists;

date_default_timezone_set('Australia/NSW');

You also need to insert an 'e' for the time zone to make it;

$todayis = date("l, F j, Y, g:i a, e") ;

obviously replace the 'Australia/NSW' with your required timezone which can be found from here

http://au.php.net/manual/en/timezones.php



The result looks like this;

Tuesday, March 24, 2009, 11:47 am, Australia/NSW



If anyone new to php like me the date and time info can be found here;

http://au.php.net/date