problem with dates

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
yuri1992
Forum Newbie
Posts: 10
Joined: Sun Aug 03, 2008 8:49 am

problem with dates

Post by yuri1992 »

hello to all ,
i have a date like 31.5.09 , i need to now what date was yesterday and what date be tomorrow
how i do this ?

thanks to all
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: problem with dates

Post by requinix »

Yesterday and tomorrow are easy. Maybe you're talking about the day before and the day after?

Break the date into month, day, and year parts, then feed them into mktime then into date. You can add and subtract 1 from the day safely, even if the result doesn't make sense - mktime is smart like that.
yuri1992
Forum Newbie
Posts: 10
Joined: Sun Aug 03, 2008 8:49 am

Re: problem with dates

Post by yuri1992 »

yes ok.
how i convert mktime to a date ?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: problem with dates

Post by requinix »

I said "into date", not "into a date".

date is a function.
Post Reply