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
https://forums.phpfreaks.com/topic/252-insert-date-in-a-table/
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
https://forums.phpfreaks.com/topic/252-insert-date-in-a-table/#findComment-767
Share on other sites

Archived

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

×
×
  • 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.