PHP Salt


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

Version: 2.20.2
Last Build: October 16, 2017 12:40pm (PST)

Main Menu

Home

Get PHP Salt


The Functions

array
file
graph
html
mail
math
misc
mobile
script
string
system
time
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