mastercjb Posted November 29, 2009 Share Posted November 29, 2009 I am using this line to get the date and time $time = date(F." ".d.", ".Y." ".g.":".i.":".sa,time()); How could I change this to my time zone here in California, USA? Link to comment https://forums.phpfreaks.com/topic/183273-time-script-set-to-my-time-zone/ Share on other sites More sharing options...
Alex Posted November 29, 2009 Share Posted November 29, 2009 Use date_default_timezone_set. Btw, you don't need to use time() as the second parameter in date(), if the second parameter is omitted it defaults to that anyway. Link to comment https://forums.phpfreaks.com/topic/183273-time-script-set-to-my-time-zone/#findComment-967312 Share on other sites More sharing options...
mastercjb Posted November 29, 2009 Author Share Posted November 29, 2009 Sorry I'm still learning, how would that look? Like this? $time = date(F." ".d.", ".Y." ".g.":".i.":".date_default_timezone_set()); Link to comment https://forums.phpfreaks.com/topic/183273-time-script-set-to-my-time-zone/#findComment-967351 Share on other sites More sharing options...
Alex Posted November 29, 2009 Share Posted November 29, 2009 No, like this: date_default_timezone_set('America/Los_Angeles'); $time = date(F." ".d.", ".Y." ".g.":".i.":"); Link to comment https://forums.phpfreaks.com/topic/183273-time-script-set-to-my-time-zone/#findComment-967353 Share on other sites More sharing options...
mastercjb Posted November 29, 2009 Author Share Posted November 29, 2009 I get this: Fatal error: Call to undefined function: date_default_timezone_set() in /home/www/acl.awardspace.biz/spheader.php on line 70 Link to comment https://forums.phpfreaks.com/topic/183273-time-script-set-to-my-time-zone/#findComment-967372 Share on other sites More sharing options...
Alex Posted November 29, 2009 Share Posted November 29, 2009 What version of PHP are you running? Link to comment https://forums.phpfreaks.com/topic/183273-time-script-set-to-my-time-zone/#findComment-967374 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.