简体   繁体   中英

date_default_timezone_set('Asia/Calcutta') not working

My site hosted in 1and1.Now the problem is time when insert values to database the US timezone is insert.not INDIA timezone. but i insert this function above file

date_default_timezone_set('Asia/Calcutta');
$x=insert into add_trans(date,time,emp_id)values(NOW(),CURTIME(),'".$_SESSION['uid']."');

Try changing "date_default_timezone_set('Asia/Calcutta');" to following;

date_default_timezone_set('Asia/Kolkata');

This may work! Let us know

Try :

$x=INSET INTO add_trans (date, time, emp_id)
   VALUES (date('d-m-Y'), date('H:i:s'), '".$_SESSION['uid']."');

(Change the format in date function as stored in DB)

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