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: command to display time in DATE format

Re: command to display time in DATE format

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 6 Jun 2006 09:23:14 -0700
Message-ID: <1149610994.370402.257220@h76g2000cwa.googlegroups.com>

Mark D Powell wrote:
> Jim Kennedy wrote:
> > <mehaboob_at_gmail.com> wrote in message
> > news:1149603061.349299.173000_at_c74g2000cwc.googlegroups.com...
> > > Hi,
> > >
> > > In oracle DB table,I have a varchar field which stores time in EPOCH
> > > fomat
> > > for eg:11652232 secs
> > >
> > > Is there a command to display the above time in Date format? (something
> > > like DD MM YY)
> > >
> > > Mehaboob
> > >
> >
> > Why store numbers in character fields? Store numbers in number fields.
> > (myfield/(24*60*60))+to_date('01/01/1970','mm/dd/yyyy'),
> > Jim
>
> Mehaboob, to display a date in any character representation always use
> to_char. So jjust put a to_char around Jim's calculation:
> to_char( column / (24 * 60 * 60) + to_date('01-01-1970','mm-dd-yyyy'),'
> DD MM YY')
>
> HTH -- Mark D Powell --

PS the thread subject line mentions displaying the time element but the OP example does not, but the TIME components can be displayed using HH, MI, and SS. See the SQL manual for full options.

UT1 > select to_char(sysdate,'YYYYMMDD HH24:MI:SS') as today from dual;

TODAY



20060606 12:22:23

HTH -- Mark D Powell -- Received on Tue Jun 06 2006 - 11:23:14 CDT

Original text of this message

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