RE: [PHP] how to get the date of this Saturday all the time?

2003-06-24 Thread Jennifer Goodie
   We have a meeting at every Saturday,I'd like to post the
 news and write the date of this Saturday every week,how can I get
 the date of Saturday.


This has not been tested, there might be a bug.
?php
function get_sat_ts($timestamp){
$dow = date(w,$timestamp);
$days_to_add = 6 - $dow;
$ts_sat = mktime
(0,0,0,date(m,$timestamp),date(d,$timestamp)+$days_to_add,date(y,$time
stamp));
return ($ts_sat);
}
$ts = get_sat_ts(time());
echo date(Y-d-m,$ts);
?

Something like that should be what you want though.




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



Re: RE: [PHP] how to get the date of this Saturday all the time?

2003-06-24 Thread poetbox
hi, Jennifer Goodie£¡
   How quickly you are!
   Thank you,I'm testting now:)


=== 2003-06-24 17:20:00 you wrote£º===

   We have a meeting at every Saturday,I'd like to post the
 news and write the date of this Saturday every week,how can I get
 the date of Saturday.


This has not been tested, there might be a bug.
?php
function get_sat_ts($timestamp){
   $dow = date(w,$timestamp);
   $days_to_add = 6 - $dow;
   $ts_sat = mktime
(0,0,0,date(m,$timestamp),date(d,$timestamp)+$days_to_add,date(y,$time
stamp));
   return ($ts_sat);
}
$ts = get_sat_ts(time());
echo date(Y-d-m,$ts);
?

Something like that should be what you want though.



.

= = = = = = = = = = = = = = = = = = = =


¡¡Thanks for your kindness.
 
 
poetbox
[EMAIL PROTECTED]
2003-06-25





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



Re: [PHP] how to get the date of this Saturday all the time?

2003-06-24 Thread James Hicks
How about 

date(Y-m-d,strtotime(next Saturday));

James Hicks


On Tuesday 24 June 2003 08:01 pm, poetbox wrote:
 hi,php-general£¬

   We have a meeting at every Saturday,I'd like to post the news and
 write the date of this Saturday every week,how can I get the date of
 Saturday. For example,today is Monday,  and today is  2003-23-06,I'd like
 to get the Saturday date 2003-28-06 ;If today is Friday on
 2003-16-08,I'd like to get the date of 2003-17-08,the date is a var got
 by a special function,How to WRITE THE FUNCTION? Any thoughts or
 suggestions would be greatly appreciated!Thanks in advance.


 poetbox
 [EMAIL PROTECTED]
 2003-06-25


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



Re: Re: [PHP] how to get the date of this Saturday all the time?

2003-06-24 Thread poetbox
hi, James Hicks£¡

?
echo   date(Y-m-d,strtotime(next Saturday));
?
I got 1970-01-01!
Perhaps you missing give me the function strtotime().



Hi,Jennifer Goodie,

Your function is very perfect!Thank you very much,I tested it and succeed!
BTW,Can you pro it in another way?
I say,I got 2003-28-06,but I like 2003-28-6,needn't the 0 before the month,is it 
difficult?If not,I'd like you to give me another function without '0' before the month!
Thank you!

=== 2003-06-24 20:36:00 you wrote£º===

How about 

date(Y-m-d,strtotime(next Saturday));

James Hicks


On Tuesday 24 June 2003 08:01 pm, poetbox wrote:
 hi,php-general£¬

   We have a meeting at every Saturday,I'd like to post the news and
 write the date of this Saturday every week,how can I get the date of
 Saturday. For example,today is Monday,  and today is  2003-23-06,I'd like
 to get the Saturday date 2003-28-06 ;If today is Friday on
 2003-16-08,I'd like to get the date of 2003-17-08,the date is a var got
 by a special function,How to WRITE THE FUNCTION? Any thoughts or
 suggestions would be greatly appreciated!Thanks in advance.


 poetbox
 [EMAIL PROTECTED]
 2003-06-25

.

= = = = = = = = = = = = = = = = = = = =


¡¡Thanks for your kindness.
 
 
poetbox
[EMAIL PROTECTED]
2003-06-25





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



Re: [PHP] how to get the date of this Saturday all the time?

2003-06-24 Thread James Hicks
On Tuesday 24 June 2003 09:18 pm, poetbox wrote:
 hi, James Hicks£¡

 ?
 echo   date(Y-m-d,strtotime(next Saturday));
 ?
 I got 1970-01-01!
 Perhaps you missing give me the function strtotime().


You must be using an old version of PHP that does not support strtotime. (PHP 
3= 3.0.12, PHP 4 ) is what the manual says. That would account for the 
output of date.

James Hicks


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



Re: [PHP] how to get the date of this Saturday all the time?

2003-06-24 Thread Joseph Szobody

 date(Y-m-d,strtotime(next Saturday));

That would give the Saturday for next week (2003-07-05). Try this Saturday or just 
Saturday.

date(Y-m-d,strtotime(this Saturday));  // Currently returns 2003-06-28

Joseph





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



Re: Re: [PHP] how to get the date of this Saturday all the time?

2003-06-24 Thread poetbox
hi, Joseph Szobody£¡

  THank you!I can only use Jennifer Goodie's way because as james 
said,my server is to old to allow the function of strtotime()!
  Thank you by any way!

=== 2003-06-24 22:17:00 you wrote£º===

 date(Y-m-d,strtotime(next Saturday));

That would give the Saturday for next week (2003-07-05). Try this Saturday or just 
Saturday.

date(Y-m-d,strtotime(this Saturday));  // Currently returns 2003-06-28

Joseph





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

.

= = = = = = = = = = = = = = = = = = = =


¡¡Thanks for your kindness.
 
 
poetbox
[EMAIL PROTECTED]
2003-06-25





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