检查日期是在工作日还是在周末? [英] Checking if date falls on weekday or weekend?
本文介绍了检查日期是在工作日还是在周末?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您如何检查日期是否采用美国格式,例如 2012-01-01 是使用PHP的工作日还是周末?
How do you check whether a date in the US format of e.g. 2012-01-01 falls on a weekday or weekend in PHP?
推荐答案
$weekday = date("w", strtotime("2012-01-01"));
从星期日到6,星期六将为0.
This will be 0 for Sunday through 6, Saturday.
http://www.php.net/manual/en/function. strtotime.php
http://php.net/manual/en/function.date.php
这篇关于检查日期是在工作日还是在周末?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文