2017-03-28 69 views
1

在这里,我有个约会条目默认mysql如何转换时间gmt格式?

输入:'2017-03-9 06:27:28'

输出:'2017-03-9 11:27:28'

我想在GMT使用php这次转换+5格式,请帮助我解决此问题的功能

+0

您的日期字符串看起来已损坏。你至少能告诉我们你想要什么输出吗? –

+0

请检查这个@TimBiegeleisen –

+0

假设你将数据库中的日期格式存储在GMT中,并且假设你有日期类型,你会发现仅仅在查询本身中添加5个小时是可以接受的吗? –

回答

2

PHP code demo

$string=strtotime("2017-03-9 06:27:28"); //converting time to timestamp 
$timestamp=strtotime("+5 hours",$string);//added zone time 
echo date("Y-m-d H:i:s", $timestamp); //displaying new time 
+0

谢谢亲爱的你的回答是有帮助的.....快乐编码:) –

+0

@MudassarZahid欢迎... :) –

+0

你能否请回顾我昨天的问题http://stackoverflow.com/questions/43047820/how-to-calculate -time-difference-with-schedule-working-bw-two-time-stamp –