RE: [PHP] Week Number

From: Date: Fri, 29 Jun 2001 17:38:52 +0000
Subject: RE: [PHP] Week Number
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55588@lists.php.net to get a copy of this message
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:trollboy@shoggoth.net] > Sent: Thursday, June 28, 2001 3:33 PM > To: php-general@lists.php.net > 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#55588) next »