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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Date format

Re: Date format

From: Jared Still <jkstill_at_bcbso.com>
Date: Tue, 16 May 2000 09:09:30 -0700 (PDT)
Message-Id: <10499.105753@fatcity.com>


Here's an example to run. This should give you enough information to write the function.

Jared


alter session set nls_date_format = 'mm/dd/yyyy';

define epoch='01/01/1970'
define seconds_per_day = 86400

prompt Here is the current SYSDATE
select to_char(sysdate,'mm/dd/yyyy hh24:mi:ss') "SYSDATE" from dual;

prompt Seconds since 1/1/1970
col cseconds new_value useconds head 'SECONDS' select to_number(sysdate - to_date('&epoch')) * &seconds_per_day cseconds from dual;

prompt Reproduce date from epoch and seconds since epoch select to_char(trunc(to_date('&epoch')) + &useconds / &seconds_per_day,'mm/dd/yyyy hh24:mi:ss') from dual;


On Tue, 16 May 2000, Sackwitz, Antje wrote:

> Hi,
> I have a long field in my table containing the date in seconds since
> 01.01.1970.
> Now I need a function/procedure to calculate the date in format
> dd.mm.yyyy min:sec to display date in select statements.
> Can anyone share knowledge to that task?
> We are running Oracle8.1.5.
>
> Regards,
> Antje
>
> -----------------------------------------------------------------
> Antje Sackwitz Phone: +49-431-7109-514
> Vossloh System-Technik GmbH Fax: +49-431-7109-675
> Edisonstr. 3 E-Mail: sackwitz_at_vst.vossloh.de
> 24145 Kiel
> -----------------------------------------------------------------
>
>
>
> --
> Author: Sackwitz, Antje
> INET: Sackwitz_at_vst.vossloh.de
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
> also send the HELP command for other information (like subscribing).
>

Jared Still
Certified Oracle DBA and Part Time Perl Evangelist ;-) Regence BlueCross BlueShield of Oregon
jkstill_at_bcbso.com - Work - preferred address Received on Tue May 16 2000 - 11:09:30 CDT

Original text of this message

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