[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MySQL: today+30 days?
On Mon, Feb 15, 1999 at 02:55:33PM -0800, Micah Yoder wrote:
> For the expiration date thing, there needs to be a way to set it to 30
> (or whatever) days into the future on signup. How do we do this? Can I
> write
>
> TTL=NOW()+30
>
> or something like that? Or do I have to figure it out in the PHP
> script?
First of all, when you take a look at the new table structures (see my previous
email) a few things have changed there... #1, TTL is now Expiration. But thats not
a big deal... figured it wasn't bad as there's not THAT much code written yet.
However, back to the point.
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