PHP Salt


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

Version: 2.33.2
Last Build: December 29, 2023 20:28pm (PST)

Main Menu

Home

Get PHP Salt


The Functions

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

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