My php web servers timezone is EDT (Eastern Day Light Time (US)). My current timezone is GMT+05.30. I need to enter current timestamp into my mysql database with the timestamp in my current timezone. By the way, I'm using a free php web server for my use. So I will not be having any previleges for modifying the server. Can some one suggest me some way of converting it to my GMT+05.30 from EDT in php using any script.Thanks in advance.
3条回答 默认 最新
- dongqing220586 2014-07-02 17:42关注
Have a look at the following example
$timezone = new DateTimeZone('Europe/Berlin'); $date = new DateTime('@' . $yourTimestamp, $timezone); echo $date->format('c');
So through the DateTimeZone Object your Time will be formatted by the DateTime object.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报