Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

big problem quick solution I hope

Status
Not open for further replies.

krappleby025

Programmer
Sep 6, 2001
347
NL
hi all,

i am trying to enter a date into a mysql database with a field setting of Datetime,

Now this is easy to do when i use the NOW() command, however i need to add a date for one months time..

so instead of 28 dec it would be 28 jan

any ideas

thanks
 
what version of MySQL are you using?

You could try:

Code:
INSERT INTO tbl_name VALUES ( DATE_ADD( NOW(), INTERVAL 1 DAYS ) );

*cLFlaVA
----------------------------
[tt]Sigs cause cancer.[/tt]
 
Sorry, should be:

Code:
INSERT INTO tbl_name VALUES ( DATE_ADD( NOW(), INTERVAL 1 [red]MONTHS[/red] ) );

*cLFlaVA
----------------------------
[tt]Sigs cause cancer.[/tt]
 
You tried string in either 'YYYY-MM-DD HH:MM:SS' or 'YY-MM-DD HH:MM:SS'
 
check the mysql forum. and answer questions people ask. like "what version are you using?"

*cLFlaVA
----------------------------
[tt]Sigs cause cancer.[/tt]
 
i dont know what version im using.. but i managed to solve the problem, using a different method than you all posted.. thanks for your help
 
it's customary to share your solution, also if you start up mysql command line processor (mysql) it tells you the version your on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top