In phpmyadmin under date_time row the time value updated like this
2015-02-22 00:40:54
Well, This code is working fine for a single value
$timezone = new DateTimeZone('America/Vancouver');
$date = new DateTime(date('m/d/Y h:i:s a', time()));
$date->setTimeZone($timezone);
$msg_time = $date->format('h:i A M d'); // current time
But what if I get a row from db like this
$msg_time = date('h:i A M d',strtotime($row["date_time"]));
again it is showing the server time for "date" so how to fix this, not need to show the client's time using js but just want to show the time in a specific timezone instead of server timezone.
The full code is here in plain txt: http://dnetbd.com/shout_php.txt
您始终可以获取时区之间的GMT偏移量并进行一些数学运算...
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.