[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MySQL: today+30 days?



Jason Pincin wrote:

Nifty.  I didn't realize PHP did that much with dates!

> In PHP, this statement will get you the date in the correct SQL format for one
> month from now:
> 
> $New_User_Expiration = date("Y-d-") . (date("m") + 1) . " " . date("H:i:s");
> 
> It's important you get it in the correct format for the DB.  If ya check out the
> date function you'll see that you can do AL sortsa neet stuff with it :).  On the
> same note, you could just as easy tell the user what day of the week they would be
> expiring on if they expired 14 years from today:
> 
> $day14yrsfromnow = date("l",
> mktime(date("H"),date("i"),date("s"),date("m"),date("d"),date("Y") + 14);
> 
> Perty cool.  Useless but cool.  I love working with dates in PHP :)
> 
> Jason