[nycphp-talk] Current weeks's dates
Hans Zaunere
zaunere at yahoo.com
Tue Sep 3 16:28:07 EDT 2002
--- "Donald J. Organ IV" <dorgan at optonline.net> wrote:
> Is there any way that anyone can think of to get a set of dates
> sun-sat for a given date?
I wrote this ages ago and haven't checked it in just as long, but no
one has complained about the libraries that use it, so it must work,
right?
define('_SECSINDAY', 86400);
define('_SECSINWEEK', 604800);
/*** returns first and last second of surrounding calendar week ***/
function time2week( $timestamp ) {
$tmp = date('G:i:s:w',$timestamp);
$tmp = explode(':',$tmp);
$tmp =
(($tmp[0]*60*60)+($tmp[1]*60)+($tmp[2]))+($tmp[3]*_SECSINDAY);
return array($timestamp-$tmp,($timestamp-$tmp)+(_SECSINWEEK-1));
}
Hans 'Hoping-No-One-Finds-A-Bug' Z.
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
More information about the talk
mailing list