简体   繁体   中英

CURTIME() gets server time not timezone specified in php.ini

I've created a php.ini containing this info

date.timezone="Asia/Riyadh"

but when inserting CURTIME() to the database it inserts the server time not the defined timezone in php so I've tried something else. Using this code

$nowTime = date('g:i a');

and insert the variable. It gets the right date but no am or pm. Any help please?

您正在使用以24小时制工作的TIME格式,因此需要在date函数中使用24小时语法,如下所示:

$nowTime = date('H:i:s');

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