here's a quick-n-dirty way.

$doy = date('z');
$week = (int)($doy / 7);
print $week+1;

but there's one thing to be wary of:
this counts full 7-day weeks, not calendar weeks, 
so since the first week of a calendar year might
begin on wednesday or friday, this algorithm might
be a few days off if you're trying to match up
the results with a calendar program.

i solved the calendar-week problem in perl a few
months ago, so i'll go look for the code and 
translate it into PHP.

> -----Original Message-----
> From: Matt "TrollBoy" Wiseman [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 28, 2001 3:33 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Week Number
> 
> 
> Does know of anyway to get PHP to return the week number?  
> As in there are 52 weeks in a year and this is week x?
> If there is no internal feature, perhaps something built into PHPLib?
> 
> Lemme know,
> Matt "TrollBoy" Wiseman
> Webmaster: Shoggoth.net
> Site Designer: phpslash.org
> The oldest and strongest emotion of mankind is fear,
> and the oldest and strongest kind of fear is fear of the unknown.
> -H.P. Lovecraft
> ---------------------------------------------------------
> Please do not resell my e-mail address
> to anyone or send me unsolicited e-mail
> ---------------------------------------------------------
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to