Page 1 of 1

increase current date by one

Posted: Mon Sep 29, 2008 1:39 am
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.

Re: increase current date by one

Posted: Mon Sep 29, 2008 1:59 am
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)