increase current date by one

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
kalpesh
Forum Commoner
Posts: 54
Joined: Sun Sep 21, 2008 5:04 am

increase current date by one

Post by kalpesh »

hi i am new to php.
i want to display week days from current date.
it means that if it is today 2008-09-29 then
i want to display as
2008-09-29
2008-09-30
2008-10-01
2008-10-02
2008-10-03
2008-10-04
2008-10-05

Please help me.
Thanks in advance.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: increase current date by one

Post by alex.barylski »

PHP Tip #5534

Don't use formatted dates...dealing with a simple timestamp is always easier and faster for the computer.

60 seconds in a minute
60 minutes in a hour
60 * 60 = 3600 seconds in a hour

Because timestamps are essentially the number of seconds sinced UNIX epoch (or whatever it's called) you can calculate the timestamp for tomorrow by doing something like:

Code: Select all

$tomorrow = time() + ((60 * 60) + 24)
Post Reply