在我的网页中,我需要计算日期[即从日期开始的SUN,MON,TUE ...]。日期的格式为['06/22/2009']这种格式?我如何计算到今天[这将显示我的MON]在php中。请帮我找出来。提前致谢..
最佳答案
首先,您可能需要使用 strtotime()
将字符串'06/22/2009'解析为时间戳:
$dt = strtotime('06/22/2009');
然后,您可以使用
date()
格式化时间戳记:$day = date("D", $dt);
如果您特别希望使用大写字母,请使用
strtoupper()
:print strtoupper($day);
关于php - php中的日期转换,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1062196/