Page 1 of 1

set day in future

Posted: Sun Sep 17, 2006 5:32 pm
by psychotomus
I want to run polls for a certain ammount of time.

how do I add the number of days to time() ??

time() + $days?

Posted: Sun Sep 17, 2006 5:35 pm
by volka

Code: Select all

<?php
$ts = time();
echo date('Y-m-d', $ts), "<br />\n";

$ts = strtotime('tomorrow');
echo date('Y-m-d', $ts), "<br />\n";

$ts = strtotime('+1 day');
echo date('Y-m-d', $ts), "<br />\n";

$ts = strtotime('+2 day');
echo date('Y-m-d', $ts), "<br />\n";

$ts = strtotime('+2 week');
echo date('Y-m-d', $ts), "<br />\n";

$ts = strtotime('next thursday');
echo date('Y-m-d', $ts), "<br />\n";

$ts = strtotime('next friday');
echo date('Y-m-d', $ts), "<br />\n";
?>
see http://de2.php.net/strtotime