PHP Salt


A little dash of PHP... my collection of php functions

Version: 2.13.2
Last Build: October 09, 2016 21:15pm (PST)

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:


See Also

And a shot out to:

LinuxSimple - www.linuxsimple.com
PHP - php.net
Fedora Server - getfedora.com
Shameless ads to pay for site