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());
精彩评论