Re: inserting date into oracle!!!
| From: | John Lim | Date: | Thu, 21 Feb 2002 17:23:29 +0000 |
| Subject: | Re: inserting date into oracle!!! | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-12199@lists.php.net to get a copy of this message | ||
INSERT into table (datecol) VALUES (TO_DATE('2002-02-30','YYYY-MM-DD'))
or
INSERT into table (datecol) VALUES (SYSDATE)
Bye, John
Nicole Amashta <430ntr3k@bellsouth.net> wrote in message
news:20020221143117.66456.qmail@pb1.pair.com...
> OK, it has been a long while since I've used Oracle, but from what I
> remember, the format of the date is *not* the one you are using. I believe
> it should look like this: yyyy-mm-dd or mm-dd-yyyy
>
> I may be wrong about the format, but I remember originally having trouble
> with the dates when I used oracle for the first time.
>
> Anyone have more insight?
>
> -Nicole
> www.aeontrek.com
>
> "Sandeep Murphy" <Sandeep.Murphy@oni.pt> wrote in message
>
> news:69E9C8885D77554CAF2A7C5C690F43595B629E@arexcprd01.e3g.pt...
> > Hi,
> >
> > I have been trying to insert the current date into ORACLE in vain...
> >
> > my query reads like this..
> >
> > java.text.SimpleDateFormat formatter = new
> > java.text.SimpleDateFormat("dd/MM/yyyy");
> > java.util.Date currentTime_1 = new java.util.Date();
> > String dateString = formatter.format(currentTime_1);
> >
> > // Have to use Java.util.date....
> >
> > out.println( "<br>" );
> > out.println( dateString ); // shows current date Fine..
> >
> > sql = "INSERT into
> > RESERV_DOC_UPD(CODE,DOC_COD,COLAB_COD,RESERVED,DATE_RESERV)";
> >
> > sql +=
> >
>
"VALUES("+temp+","+code+","+COLAB_COD+","+RESERVED+","+(to_date(dateString,
> > dd/mm/yyyy))+")";
> >
> > Can anyone Please tell me whats wrong with this query and the remedy for
> > it!!???
> >
> > Thnx a lot in adv,
> >
> > gaucho
>
>