note 9495 deleted from function.getdate by jimw
| From: | jimw@php.net | Date: | Mon, 22 Oct 2001 23:40:33 +0000 |
| Subject: | note 9495 deleted from function.getdate by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19297@lists.php.net to get a copy of this message | ||
//some daft date range code for the taking, from tonight at midnight ($span_end) back to whenever
you chose.
$today = getdate();
$span_end =
$today[year].'-'.($today[mon]<10?'0'.$today[mon]:$today[mon]).'-'.($today[mday]<10?'0'.($today[mday]+1):($today[mday]+1));
switch($span){
case 'day':
$span_start =
$today[year].'-'.($today[mon]<10?'0'.$today[mon]:$today[mon]).'-'.($today[mday]<10?'0'.$today[mday]:$today[mday]);
break;
case 'week':
$span_start =
$today[year].'-'.($today[mon]<10?'0'.$today[mon]:$today[mon]).'-'.($today[mday]<10?'0'.($today[mday]-7):($today[mday]-7));
break;
case 'month':
$span_start =
$today[year].'-'.($today[mon]<10?'0'.($today[mon]-1):($today[mon]-1)).'-'.($today[mday]<10?'0'.$today[mday]:$today[mday]);
break;
case 'year':
$span_start =
($today[year]-1).'-'.($today[mon]<10?'0'.$today[mon]:$today[mon]).'-'.($today[mday]<10?'0'.$today[mday]:$today[mday]);
break;
}