ZuluGod Posted April 10, 2015 Posted April 10, 2015 Hi,Does anyone know of a way to change the timezone in CPanel (or in code) so that I can have NOW() return the time in the timezone of AEST instead of PST, as my users are all from Australia and none are from America.
nyten Posted April 10, 2015 Posted April 10, 2015 If you use php, try this: date_default_timezone_set('Australia/Brisbane'); http://php.net/manual/en/function.date-default-timezone-set.phphttp://php.net/manual/en/timezones.australia.php
Timmy Posted May 1, 2015 Posted May 1, 2015 This topic is a little old but I think I might be able to add a little bit more information about changing timezones. PHPHere's an example on how to get and change timezones. Changing the timezone affects functions related to time and date: <?php echo date_default_timezone_get(); // Get default timezone used by date/time functions echo date('Y-m-d H:i:s'); // Get current time date_default_timezone_set("UTC"); // Change default timezone to UTC echo date_default_timezone_get(); // Get default timezone used by date/time functions echo date('Y-m-d H:i:s'); // Get current time Will output: America/Los_Angeles 2015-05-01 06:14:49 UTC 2015-05-01 13:14:49 SQLNow, you were probably referring to the NOW() function in SQL. Get timezone used by server:SELECT @@system_time_zone;Will output:PDT Change timezone used by server (for current session): SET time_zone = '+00:00'; -- Change timezone to UTC SELECT NOW(); Will output:2015-05-01 13:16:28
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now