Page 1 of 1
date problem
Posted: Fri Nov 18, 2005 3:17 am
by gurjit
hi all,
how do i get the date for the nearest friday lets say 6 weeks from today.
so if the date lets say was stored in the database as:
2005-11-15
then i need 6 weeks and closest friday which would give me:
2005-12-30
Posted: Fri Nov 18, 2005 5:02 am
by Chris Corbyn
This will give you the nearest friday *after* 6 weeks so you always get at least 6 weeks.
Code: Select all
$next_fri = strtotime('next friday'); //Gets timestamp for midnight on the next friday (or today if today is friday)
$_6_wks_fri = strtotime('+6 weeks', $next_fri);
echo date('jS M Y', $_6_wks_fri);
Posted: Mon Nov 21, 2005 3:10 am
by gurjit
hi d11wtq,
that works great but how can i make
Code: Select all
<?php
$next_fri = strtotime('next friday'); //Gets timestamp for midnight on the next friday (or today if today is friday)
?>
a variable date. I have to pull the date out of a database and it needs to calculate the closest friday and then 6 weeks from there????