[PHP] Get timestamp?

2006-01-25 Thread Jay Paulson
For some reason my brain isn't working correctly today.

How would I go about getting the timestamp of a day of the week from 7 weeks
ago?

In my case I'm getting the timestamp of last Sunday (no matter what day of
the week it is currently) and I want to get the timestamp of the Sunday that
happened 7 weeks ago.

$lastSunday = strtotime(last Sunday);
$Sunday7Weeks = $lastSunday - ???;

Thanks

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



Re: [PHP] Get timestamp?

2006-01-25 Thread Philip Hallstrom

How would I go about getting the timestamp of a day of the week from 7 weeks
ago?

In my case I'm getting the timestamp of last Sunday (no matter what day of
the week it is currently) and I want to get the timestamp of the Sunday that
happened 7 weeks ago.

$lastSunday = strtotime(last Sunday);
$Sunday7Weeks = $lastSunday - ???;


$Sunday7Weeks = $lastSunday - 86400 * 7 * 7; // 86400 seconds in a day

-philip

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



Re: [PHP] Get timestamp?

2006-01-25 Thread Max Schwanekamp

Jay Paulson wrote:
 How would I go about getting the timestamp of a day of the week from 
7 weeks

 ago?
 $lastSunday = strtotime(last Sunday);
 $Sunday7Weeks = $lastSunday - ???;

$lastsunday = strtotime(last Sunday);
$sunday7weeks = $lastsunday - (86400 * 49); // 7 weeks = 49 days

Test:
echo 'Last Sunday\'s date was '.date(m/d/y,$lastsunday);
echo 'br7 Weeks prior to Last Sunday, the date was 
'.date(m/d/y,$sunday7weeks);


--
Max Schwanekamp
http://www.neptunewebworks.com/

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



Re: [PHP] Get timestamp?

2006-01-25 Thread Max Schwanekamp

Max Schwanekamp wrote:


Jay Paulson wrote:
 How would I go about getting the timestamp of a day of the week from 
7 weeks

 ago?

$lastsunday = strtotime(last Sunday);
$sunday7weeks = $lastsunday - (86400 * 49); // 7 weeks = 49 days


Oops, that would be the sunday 7 weeks prior to _last_ Sunday, which 
would really be Sunday 8 weeks ago, so maybe change the 49 to 42...


--
Max Schwanekamp
http://www.neptunewebworks.com/

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