简体   繁体   中英

Change Time MYSQL / PHPMYADMIN

I am new to this forum and learning.

I want to ask that how can I change my time in PHP? As the entries storing on MySQL are in a different timezone.

I have tried everything but no results.

For example:

  1. SET SESSION time_zone = "-4:00";

  2. htaccess #Adjust default time zone
    SetEnv TZ America/Washington

  3. even changing in select php version

I tried most of the options but nothing seems to work. I even tried contacting my hosting provider, he said no as it is shared hosting or he doesn't know how to do it.

You can use date_default_timezone_set function as below:

date_default_timezone_set('America/Anchorage');
echo date("Y-m-d H:i:s");

But as far as I know, there is not a legal time zone America/Washington . Please correct this and you can check available timezone on this link https://www.php.net/manual/en/timezones.america.php . Hope it helps you!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM