php - mysql - change timezone not working

Vishnu

I tried below code

date_default_timezone_set('America/Los_Angeles'); 
$ok = inputs("SET timezone = 'America/Los_Angeles'");
$ok = inputs("INSERT INTO `table` (`date`) VALUES ( CURRENT_TIMESTAMP); ");

CURRENT_TIMESTAMP is still printing my server time.It is ignoring the timezone I set.Can some one tell me where I am wrong? thank you.

Abhishek Sharma

Set time zone of MySQL

SET GLOBAL time_zone = '+8:00'; //Your timezone
SET GLOBAL time_zone = 'America/Los_Angeles';//Your timezone name
SET @@global.time_zone='+00:00';//Your timezone

For check current timezone :-

SELECT @@global.time_zone;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related