Page 1 of 1

add some number of days to current date

Posted: Thu Jun 08, 2006 1:28 am
by madhu
hi to all.........

i have small problem , please give suggestions how to implement this feature..........

problem:

am trying to add 7 days to current system date,but it is not correctly adding.

please tell where is the problem in my code.

code:

<?php

echo $today = date("Y-m-d").'<br/>';

$month = date("m"); //06

$year = date("Y"); //2006

$day = date("d"); //08

echo $day = $day + 7 .'<br/>';

echo date ("Y-m-d", mktime ($year,$month,$day));

?>

Posted: Thu Jun 08, 2006 1:40 am
by PrObLeM
Yay manual!
int mktime ( [int hour [, int minute [, int second [, int month [, int day [, int year [, int is_dst]]]]]]] )

Code: Select all

echo date ("Y-m-d", mktime (0, 0, 0, $month, $day, $year));

Re: add some number of days to current date

Posted: Thu Jun 08, 2006 1:53 am
by aerodromoi
How about:

Code: Select all

<?php
echo date("Y-m-d",strtotime("+1 week"));
?>
aerodromoi