Re: adding days to a given date

From: Date: Wed, 31 Mar 2004 09:20:01 +0000
Subject: Re: adding days to a given date
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-181914@lists.php.net to get a copy of this message
thanx Richard, that works excellent. Merlin Richard Hawkes wrote:
You'll want to do something like this: $timeStamp = strtotime("2004-04-29"); $timeStamp += 24 * 60 * 60 * 7; // (add 7 days) $newDate = date("Y-m-d", $timeStamp); The 'strtotime' function converts all sorts of standard dates to the Unix Epoch seconds (seconds since 1/1/1970). You then just add the required seconds! Cheers Richard -----Original Message----- From: Merlin [mailto:news.groups@web.de] Sent: 31 March 2004 10:01 To: php-general@lists.php.net Subject: [PHP] adding days to a given date Hi there, I am trying to add days to a given day, but somehow I am lost in all the time functions. This should be a standard function. Maybe someone has a good hint for me? This is the given day: 2004-04-29 I would like to add 2 days to it. So php should anyhow now how many days April has to result in this: 2004-04-30 2004-05-1 Thank you for any helpful hint, merlin


« previous php.general (#181914) next »