Re: Add 1 Year to current date ?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: Add 1 Year to current date ?

From: Gordon Burditt <gordonb.iv38w@burditt.org>
Date: Thu Sep 22 2005 - 21:38:56 CEST

>I've been through the php.net docs, and this newsgroup - and all seems
>to be configured properly, but this statement is still not working:
>
>switch ($level) {
> case 1:
> $nextyear = mktime(0,0,0,date("Y")+1,date("m"),date("d"));
> $nextyear = strftime("%Y%m%d",$nextyear);
> break;
>
>< snip case >
>
> $query = "INSERT INTO users VALUES (NULL, '$username',
>password('$userpassword'), $level, '$fname', '$lname', '$tel',
>'$email', '$addr', '$city', '$prov', '$country', '$pcode', 'comm',
>'$today', '$nextyear')";
>
>Any ideas ? It's a date field in the table - it displays:
>YYYY-MM-DD --> 2005-09-22

I would replace '$nextyear' in the MySQL query with:
        adddate(now(), INTERVAL 1 YEAR)

                                                Gordon L. Burditt
Received on Tue Oct 18 02:26:54 2005