Re: [PHP] Determine week

2002-06-16 Thread Rosen

Thanks,
but I think you didn't understand me.
I have the number of week in a year ( some number of week, not current
week ) and I must determite start  end date of given week.

Can you help me with some ides ?

Thanks,
Rosen



John Holmes [EMAIL PROTECTED] wrote in message
006101c214d9$dc9423f0$b402a8c0@mango">news:006101c214d9$dc9423f0$b402a8c0@mango...
 You'll need a combination of date() and mktime().

 I'm too lazy to write the exact code right now, but date('w') will
 return the day of the week, 0 = Sunday, 6 = Saturday. Then use mktime()
 to subtract the number returned from date('w') from the days component,
 and you'll have the start of the week. 6 minus the result of date('w'),
 added to the day component of mktime(), will give you the end...

 HTH,
 ---John Holmes...


  -Original Message-
  From: Rosen [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, June 15, 2002 7:55 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] Determine week
 
  Hi,
  how can I determine dates (start  end ) in one week.
  I.e. 30th  week is between 22.07.2002 and 28.07.2002 .
 
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Determine week

2002-06-16 Thread Tom Rogers

Hi
Here is a messy solution, but I think it does what you want using strtotime()
(well worth looking up in the manual :)

?
$weeks = 30;
$year = date(Y);
$monday1 = strtotime(1 monday,strtotime(1/1/.$year));   //get unix 
time of first monday of this year
$monday = intval(date(d,$monday1));   //get the 
day of the month
if($monday != 1):
 $week1 = strtotime(-1 week,$monday1); //first 
week started last year
else:
 $week1 = $monday1;  //neat 
this year started on a monday
endif;
$start = strtotime($weeks. monday,$week1);//get unix 
time of start * the number of weeks
$end = strtotime(next sunday,$start); //get unix 
time of end
//print them out as dates
echo Week $weeks start date = .date(d/m/Y,$start). end date = 
.date(d/m/Y,$end).br;
?

Tom




At 02:55 AM 16/06/2002 +0300, Rosen wrote:
Hi,
how can I determine dates (start  end ) in one week.
I.e. 30th  week is between 22.07.2002 and 28.07.2002 .





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Determine week

2002-06-15 Thread John Holmes

You'll need a combination of date() and mktime().

I'm too lazy to write the exact code right now, but date('w') will
return the day of the week, 0 = Sunday, 6 = Saturday. Then use mktime()
to subtract the number returned from date('w') from the days component,
and you'll have the start of the week. 6 minus the result of date('w'),
added to the day component of mktime(), will give you the end...

HTH,
---John Holmes...


 -Original Message-
 From: Rosen [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, June 15, 2002 7:55 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Determine week
 
 Hi,
 how can I determine dates (start  end ) in one week.
 I.e. 30th  week is between 22.07.2002 and 28.07.2002 .
 
 
 
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php