您使用
strtotime()和
date():
<?php$s = 'Monday, September 28, 2009';$time = strtotime($s);$start = strtotime('last sunday, 12pm', $time);$end = strtotime('next saturday, 11:59am', $time);$format = 'l, F j, Y g:i A';$start_day = date($format, $start);$end_day = date($format, $end);header('Content-Type: text/plain');echo "Input: $snOutput: $start_day - $end_day";?>
输出:
Input: Monday, September 28, 2009Output: Sunday, September 27, 2009 12:00 PM - Saturday, October 3, 2009 11:59 AM
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)