Jump to content

Archived

This topic is now archived and is closed to further replies.

first_lady_the_queen

insert date in a table

Recommended Posts

hi i hope someone can help..

 

i got the following db table

 


create table project (

projectnr    int         not null unique,

description  varchar(100)not null,

start        date        not null,

end          date        not null,

belongs      int         not null,

lnkontakt    varchar(50) not null,

fnkontakt    varchar(50) not null,

mkontakt     varchar(50) not null,

status       int         not null,

primary key (projectnr)

);

 

then i like to add values...

now how can i set the end time? i tried now()+100 but doesnt work.

 


insert into project values (1,Projektbeschrieb, now(), now()+xx , Zugehörigkeit (Projekt), Konatk Nachname, Kontakt Vorname, Kontakt Mail, Projektstatus);

 

many thx[/code]

Share this post


Link to post
Share on other sites

The format of the date type is

 

\"YYYY-MM-DD\"

 

So instead of using now(),

 

use

 

DATE_ADD(CURRENT_DATE(), INTERVAL 100 DAY)

 

For getting the current date, add 100 days to it and return it in the correct date format \"yyyy-mm-dd\"

 

Not to be annoying, but read the docs at

http://www.mysql.com/doc/en/Date_and_time_..._functions.html

 

P.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.