Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/sbboke.com/wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php:409) in /www/wwwroot/sbboke.com/wp-content/themes/pacify/content-single.php on line 5

magento 获取系统当前时间

前段时间,发现magento的订阅用户的表里没有时间的保存,所以就打算添加一个时间的字段,因为magento的时间是UTC时区的时间,所以要通过magento的函数来获取

在百度看了一些获取时间的代码,类似

Mage::getModel('core/date')->date('Y-m-d H:i:s');

又或者

$currentTimestamp = Mage::getModel('core/date')->timestamp(time());
date("Y-m-d h:i:sa", $currentTimestamp);

但是这些都可以获取到时间,但是这个时间和注册表里的时间都差了几个小时,后来找到

Mage::getModel('core/date')->gmtDate('Y-m-d H:i:s');

这个才是最好的时间获取方式!!!

相关文章

0 0 投票数
文章评分
订阅评论
提醒
0 评论
内联反馈
查看所有评论