Todays time and date + and - five days with PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
oskare100
Forum Commoner
Posts: 80
Joined: Sun Oct 29, 2006 5:47 am

Todays time and date + and - five days with PHP

Post by oskare100 »

Hello,
When the scripts requests from the Ebay API it need to supply the current time and date plus five days and minus five days.

It needs to be in this format: 2007-01-17T18:28:52.799Z
So if now is 2007-01-20 18:28:52 then I need he script to create two variables with the following values;
(Minus five days) $time_from = 2007-01-15T18:28:52.799Z
(Plus five days) $time_to: = 2007-01-25T18:28:52.799Z

How can I make PHP add minus five days to, for example, $time_from and plus five days to, for example, $time_to as above?

Thanks in advance,
/Oskar R
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

see strtotime() and date() at http://de3.php.net/manual/en/ref.datetime.php
Post Reply