psWeek;() Returns the week number
Description:
This will return the week number for a date given. This differs from the date("W") as it will return 52 for the date "01/01/2011"
Usage:
$week = psWeek([UNIX_TIME])
Example:
$ts = strtotime("01/01/2011"); $week = psWeek($ts); //$week will be 1;
$week = date("W", strtotime("01/03/2011")); //$week will be 52
Code:
function psWeek($ts="") { if ($ts == "") { $ts = time(); } return ceil( ( date("z", $ts) + 1) / 7 ); }
Changlelog:
|