Jump to content


Photo

insert date in a table


  • Please log in to reply
1 reply to this topic

#1 first_lady_the_queen

first_lady_the_queen
  • Members
  • Pip
  • Newbie
  • 3 posts
  • Locationswitzerland

Posted 23 March 2003 - 08:56 AM

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]
slsk forever

#2 pallevillesen

pallevillesen
  • Members
  • PipPipPip
  • Advanced Member
  • 135 posts
  • LocationDenmark

Posted 24 March 2003 - 12:26 PM

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..._functions.html

P.
Palle Villesen, www.birc.dk [br]Bioinformatics Research Center




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users