random1 Posted December 30, 2007 Share Posted December 30, 2007 Hi, I'm using PHP and Apache (latest versions). I'm using the code: $fulldatetime = date("l, jS") . " of " . date("F Y") . "<strong>" . date(" g:i A") . " AEST</strong>"; to get the full date on the server. But the time is incorrect, it displays: Sunday, 30th of December 2007 1:05 AM AEST instead of: Sunday, 30th of December 2007 12:13 PM AEST How can I set the date and time to the correct one? Quote Link to comment https://forums.phpfreaks.com/topic/83670-correcting-php-date-time-on-server/ Share on other sites More sharing options...
cooldude832 Posted December 30, 2007 Share Posted December 30, 2007 your server will always get its time from the system clock so if that server system clock reads that that is what it is the date function retruns the date as it currently is if you havee a second param then it adjusts accordingly to that param Quote Link to comment https://forums.phpfreaks.com/topic/83670-correcting-php-date-time-on-server/#findComment-425638 Share on other sites More sharing options...
PFMaBiSmAd Posted December 30, 2007 Share Posted December 30, 2007 See this - http://php.net/date_default_timezone_set and/or this - http://www.php.net/manual/en/ref.datetime.php#ini.date.timezone Quote Link to comment https://forums.phpfreaks.com/topic/83670-correcting-php-date-time-on-server/#findComment-425642 Share on other sites More sharing options...
random1 Posted December 30, 2007 Author Share Posted December 30, 2007 See this - http://php.net/date_default_timezone_set and/or this - http://www.php.net/manual/en/ref.datetime.php#ini.date.timezone Thanks I got this working: date_default_timezone_set("Australia/Sydney"); Quote Link to comment https://forums.phpfreaks.com/topic/83670-correcting-php-date-time-on-server/#findComment-425675 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.