Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Calculating with dates

mac_doggiemac_doggie Member Posts: 488
Hi,

I'n quite a newbe with MySQL so this shouln't be a hard question for all you guys:

I want to insert a `year from today` date into a date field.

Something like:

[code]
INSERT INTO USER
fields(expDate)
values(CURDATE() + YEAR(1))
[/code]

but I don't think the YEAR(1) function will do this... Can someone please tell me how to do this ?


;-)
-mac-
mailto:programmersheaven@mac-doggie.nl
the Netherlands...

Comments

  • JonathanJonathan Member Posts: 2,914
    Hi,

    : I'n quite a newbe with MySQL so this shouln't be a hard question for
    : all you guys:
    :
    : I want to insert a `year from today` date into a date field.
    :
    : Something like:
    :
    : [code]
    : INSERT INTO USER
    : fields(expDate)
    : values(CURDATE() + YEAR(1))
    : [/code]
    :
    : but I don't think the YEAR(1) function will do this... Can someone
    : please tell me how to do this ?
    Instead of CURDATE + YEAR(1) try this:-

    NOW() + INTERVAL 1 YEAR

    Does that work for you?

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Sign In or Register to comment.