如何比较两个 Zend_Date 对象的日期部分?
我想检查 Zend_Date
日期时间是否在同一天。我怎样才能做到这一点?
$date1 = new Zend_Date('2011-11-14 10:45:00');
$date2 = new Zend_Date('2011-11-14 19:15:00');
I'd like to check if to Zend_Date
datetimes are on the same day. How can I do that?
$date1 = new Zend_Date('2011-11-14 10:45:00');
$date2 = new Zend_Date('2011-11-14 19:15:00');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
另请参阅比较日期一章与 Zend Date
顺便说一句,我强烈建议您验证是否需要
Zend_Date
。不要仅仅因为它是 ZF 的一部分就使用它。Zend_Date
所做的大部分工作都可以通过本机 更快、更舒适地实现DateTime
以及:评论后编辑
如果你想比较是否是同一日期就这样做
Also see the chapter on Comparing Dates with Zend Date
On a sidenote, I strongly encourage you to verify if you have the need for
Zend_Date
. Do not use it just because it is part of ZF. Most of whatZend_Date
does can be achieved faster and more comfortably with nativeDateTime
as well:EDIT after comments
If you want to compare whether it's the same date just do