php-general | 2004032
Date: 03/31/04
- Next message: Jason Wong: "Re: [PHP] adding days to a given date"
- Previous message: Merlin: "[PHP] adding days to a given date"
- Maybe in reply to: Merlin: "[PHP] adding days to a given date"
- Next in thread: Jason Wong: "Re: [PHP] adding days to a given date"
- Reply: Jason Wong: "Re: [PHP] adding days to a given date"
- Reply: Merlin: "Re: [PHP] adding days to a given date"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 <email protected>]
Sent: 31 March 2004 10:01
To: php-general <email protected>
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
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php============================================================================== This message is for the sole use of the intended recipient. If you received this message in error please delete it and notify us. If this message was misdirected, CSFB does not waive any confidentiality or privilege. CSFB retains and monitors electronic communications sent through its network. Instructions transmitted over this system are not binding on CSFB until they are confirmed by us. Message transmission is not guaranteed to be secure. ==============================================================================
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Jason Wong: "Re: [PHP] adding days to a given date"
- Previous message: Merlin: "[PHP] adding days to a given date"
- Maybe in reply to: Merlin: "[PHP] adding days to a given date"
- Next in thread: Jason Wong: "Re: [PHP] adding days to a given date"
- Reply: Jason Wong: "Re: [PHP] adding days to a given date"
- Reply: Merlin: "Re: [PHP] adding days to a given date"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

