Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to set Date/Timestamp

Re: How to set Date/Timestamp

From: Billy Verreynne <vslabs_at_onwe.co.za>
Date: Thu, 07 Mar 2002 09:34:34 GMT
Message-ID: <3c8732ef.11080455@news.saix.net>


nagendra rai <nagendra.rai_at_Sun.COM> wrote:

> I am trying to set and get timestamp from oracle by using
>JDBC. I want to read the timestamp in UTC. I am using a calendar
>havin timezone UTC. It is not working. Could somebody help me
>by providing some information on how to set and get dates to data database.

Look at the TO_DATE and TO_CHAR format functions in the Oracle 8i SQL Reference manual (available in both HTML and PDF versions usually with your Oracle Server software installation CD's).

Simply put :
VARCHAR2 := TO_DATE( datevariable, 'dateformat' ) DATE := TO_CHAR( stringvariable, 'dateformat' )

dateformat:
yyyy for year, mm for month, dd for day, hh24 for 24 hour format, hh for hour format, mi for minutes and ss for seconds. Various other formats are also supported like ddd for Julian day, etc.

--
Billy
Received on Thu Mar 07 2002 - 03:34:34 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US