Where do I find Date class in Zend Framework 2.0?

2019-01-24 08:27发布

I have started my ZF2 application from Skeleton-Application. I want instance of Date class in one of my controller. I tried to search Date.php class under...

library\Zend\

but could not found. Does ZF2 has not Date.php at all or I need to palce it from somewhere else?

2条回答
来,给爷笑一个
2楼-- · 2019-01-24 09:03

Zend_Date has been removed in favor of PHP 5.3 DateTime API http://es.php.net/manual/en/book.datetime.php

查看更多
ゆ 、 Hurt°
3楼-- · 2019-01-24 09:18

Don't forget to call DateTime() in Zend Framework 2 like base class.
Like:

$date = new \DateTime($str);

where $str is a string from which you create date object.

查看更多
登录 后发表回答