PHP 時區 timezone 設定

php.ini找到

[Date]
;date.timezone =

改為

[Date]
date.timezone = "Asia/Taipei"

記得前面的冒號 ; 要拿掉
然後重新啟動apache即可

也有另外一種方式使用 php function

在php內只要輸入


 date_default_timezone_set("Asia/Taipei"); 或 ini_set("date.timezone", 'Asia/Taipei'); 
MYSQL讀取時區設定:
先查MySQL的時區設定,語法如下:
SHOW VARIABLES LIKE '%time_zone%';
若使用的是UTC(世界標準時間),我們的時區跟UTC差八小時,所以要執行下列的語法來變更:
SET TIME_ZONE='+8:00';
SHOW VARIABLES LIKE '%time_zone%';

若還是不行,則執行語法如下
將 NOW()改成
DATE_ADD(NOW(),INTERVAL 8 HOUR)
  • 1 brukere syntes dette svaret var til hjelp
Var dette svaret til hjelp?

Relaterte artikler

Manual backup via WHM

ran this command # /scripts/cpbackup --force & got following output [cpbackup] Process...

How to complete uninstall Attracta tool?

Please run following command.  /usr/local/cpanel/3rdparty/attracta/scripts/uninstall-attracta

How do I know if a partition is ext2, ext3, or ext4?

The option is to use blkid: # blkid /dev/sda1 /dev/sda1:...

使用mod_Bandwidth 限制連線數與速度教學

# wget ftp://ftp.cohprog.com/pub/apache/module/1.3.0/mod_bandwidth.c# apxs -cia mod_bandwidth.c...

Rsync Backup/Restore Instructions of cloud servers.

Detailed Rsync backup instructions are available   To begin, simply log in as root to...