RE: [PHP] how to get the date of this Saturday all the time?
| From: | Jennifer Goodie | Date: | Wed, 25 Jun 2003 00:20:21 +0000 |
| Subject: | RE: [PHP] how to get the date of this Saturday all the time? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152677@lists.php.net to get a copy of this message | ||
> 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.