2010-08-13 53 views
0

有谁知道的PHP类或图书馆,帮助处理日期(意思是工作日)?例如,我可以用它来表示“给我下周二9:00的时间戳”或“下个周二和下周四之间的这个时间戳”。php - 处理平日的好'约会'类?

我只是有一部分应用程序需要确保我不在某些时间安排任务。

回答

4

有内置DateTime类,但你甚至不需要它了这一点:

//this gives results in the default timezone 
//timestamp for next Tuesday at 9:00 
strtotime("next tuesday 09:00"); 
//is this timestamp between next Tuesday and next Thursday 
$ts >= strtotime("next tuesday") && $ts < strtotime("next friday") 
2

如果你必须使用一个类Zend_Date是相当强大的。它带有Zend框架,但据我所知它非常独立。没有义务实施MVC和所有其他Zend的东西。