?php date_default_timezone_set( PRC $mydatestring = array('now','today','tomorrow','yesterday','thursday','this thursday','last thursday','+2 hours','-1 month','30 seconds','next week','last year','2 weeks ago'); foreach($mydatestring as $item) { echo $item: .date('r',strtotime($item)).' br / } ? 输出: now:Sat, 28 Feb 2009 11:03:35 +0800 today:Sat, 28 Feb 2009 00:00:00 +0800 tomorrow:Sun, 01 Mar 2009 00:00:00 +0800 yesterday:Fri, 27 Feb 2009 00:00:00 +0800 thursday:Thu, 05 Mar 2009 00:00:00 +0800 this thursday:Thu, 05 Mar 2009 00:00:00 +0800 last thursday:Thu, 26 Feb 2009 00:00:00 +0800 +2 hours:Sat, 28 Feb 2009 13:03:35 +0800 -1 month:Wed, 28 Jan 2009 11:03:35 +0800 30 seconds:Sat, 28 Feb 2009 11:04:05 +0800 next week:Sat, 07 Mar 2009 11:03:35 +0800 last year:Thu, 28 Feb 2008 11:03:35 +0800 2 weeks ago:Sat, 14 Feb 2009 11:03:35 +0800再如我要查找下个月的第一个星期五:
$nextmonth = date('Y-'.(date('n')+1).'-0'); $nextmonth_timest = strtotime($nextmonth); $first_fri = strtotime('Fri',$nextmonth_timest); echo Today: .date('Y-m-d'); echo ' br / echo 'the first Fri of next month is :'.date('Y-m-d',$first_fri); 输出: Today:2009-02-28 the first Fri of next month is :2009-03-06还有太多太多,以后有时间再写。html教程