Re: [PHP] Week Number

2001-06-30 Thread Luke Welling

Matt TrollBoy Wiseman [EMAIL PROTECTED] wrote:
 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?

How about:

intval( date(z)/7 );

Luke Welling
---
PHP and MySQL Web Development
by Luke Welling and Laura Thomson
http://www.amazon.com/exec/obidos/ASIN/0672317842/tangledwebdesign



-- 
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]




RE: [PHP] Week Number

2001-06-30 Thread scott [gts]

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]




Re: [PHP] Week Number

2001-06-30 Thread Data Driven Design

I didn't see anything built in but you might try   (date(z)/7) +1


Data Driven Design
P.O. Box 1084
Holly Hill, Florida 32125-1084

http://www.datadrivendesign.com
http://www.rossidesigns.net
- Original Message - 
From: Matt TrollBoy Wiseman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, June 28, 2001 3:33 PM
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]




Re: [PHP] Week Number

2001-06-30 Thread Matt \TrollBoy\ Wiseman

Thanks to all of you that responded, I was so busy searching the manual for
that specific function I forgot all about figuring it myself from
date(z)... I really gotta lay off that crack pipe.  Thanks again guys.
Also, another item, I know the list is back up now, but this was mail was
sent a solid DAY before I recieved it back through the list.. that's not
very good, perhaps the powers that be should look over the list again...

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
-


- Original Message -
From: Brian Paulson [EMAIL PROTECTED]
To: 'Matt TrollBoy Wiseman' [EMAIL PROTECTED]
Sent: Friday, June 29, 2001 2:27 PM
Subject: RE: [PHP] Week Number


 When I needed this before I did dome thing like this

 ?
 // z day of the year i.e. 0-365
 $days = date(z);
 //Devide number of days by 7 number of day in the week
 $math = ($days/7);
 //result is a number like 25.7435445
 //so we explode that and take the first number which is what we want
 $math = explode(.,$math);
 //then set week to = that number
 $week = $math[0];
 //and print
 Print($week);
 ?

 Hope that helps

 Thank You
 Brian Paulson
 Sr. Web Developer
 [EMAIL PROTECTED]
 The Pueblo Chieftain
 www.chieftain.com
 1-800-279-6397


 -Original Message-
 From: Matt TrollBoy Wiseman [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, June 28, 2001 1: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]




RE: [PHP] Week Number

2001-06-30 Thread Don Read


On 28-Jun-01 Matt \TrollBoy\ Wiseman wrote:
 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?

don't bet on it.

 If there is no internal feature, perhaps something built into PHPLib?

date('z') / 7;
strftime('%U %V %W');

Regards,
-- 
Don Read   [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
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]




Re: [PHP] Week Number

2001-06-30 Thread Hugh Bothwell

How about this?

$today = getdate();
$week = (int) ($today[yday] / 7);

Note: I'm not sure whether $today[yday] begins with 0 or 1.

Matt TrollBoy Wiseman [EMAIL PROTECTED] wrote in message
009801c10009$2a68c720$[EMAIL PROTECTED]">news:009801c10009$2a68c720$[EMAIL PROTECTED]...
 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?




-- 
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]




Re: [PHP] Week Number

2001-06-30 Thread Delbono

You can use Date_Calc class

http://www.phpinsider.com/php/code/Date_Calc/



- Original Message - 
From: Don Read [EMAIL PROTECTED]
To: Matt TrollBoy Wiseman [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, June 29, 2001 10:19 PM
Subject: RE: [PHP] Week Number


 
 On 28-Jun-01 Matt \TrollBoy\ Wiseman wrote:
  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?
 
 don't bet on it.
 
  If there is no internal feature, perhaps something built into PHPLib?
 
 date('z') / 7;
 strftime('%U %V %W');
 
 Regards,
 -- 
 Don Read   [EMAIL PROTECTED]
 -- It's always darkest before the dawn. So if you are going to 
steal the neighbor's newspaper, that's the time to do it.
 
 -- 
 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]