开发者

Get GMT timestamp using Zend_Date

I use the following code to get current time stamp. How do I get GMT time instead of local time?

$date = Zend_Date::now();
$timeStamp = $date->getIs开发者_StackOverflowo();


/Zend/Date.php said

 * Always set the default timezone: http://php.net/date_default_timezone_set
 * For example, in your bootstrap: date_default_timezone_set('America/Los_Angeles');

If your timezone is different and you still want to get GMT without changing default try this

$date = Zend_Date::now();
$timeStamp = gmdate("Y-m-d H:i:s", $date->getTimestamp());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜