Jump to content

insert date in a table


first_lady_the_queen

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]

Link to comment
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.