Re: datediff()

From: Alastair Newson <anewson_at_cix.compulink.co.uk>
Date: Wed, 7 Dec 1994 18:22:32 GMT
Message-ID: <D0GDpK.2nx_at_cix.compulink.co.uk>


David,

Again not knowing what your posting was about or to,

> .... The internal date format is 7 bytes: century, year, month,
> day, hour, minute, second. It's documented in the OCI manual, and in
> the precompiler guide.
>
> Oracle does not use floating point internally for anything.
>
> --Tim (tssmith_at_oracle.com)

Agree with the above (Tim's at Oracle anyway so who am I to disagree <g>).

Confusion can arise as you can find decimals popping up for part of a day as the result of date calculations. You can also use this.

eg. sysdate + 1 is the same time tomorrow.

    sysdate + 0.5 is 12 hours later

Notice it's a decimal 'fraction' of the day and not milliseconds.     

I've found this useful in a number of places like when snapshots should refresh.

eg. create snapshot ....

      ...
      refresh next sysdate + (1/24)
      
      will refresh once an hour
      
      sysdate + (1/(24*12))  ; every 5 minutes
      

If you take one date from another the result is a number of 'decimal days'

eg. left_date - joined_date = 37.5

Alastair Newson             'When the best leader's work is done, 
Technical Projects Manager          the people say, 
Glaxo Pharms UK Ltd              "We did it ourselves!"'
44-(0)181-990-3023 Received on Wed Dec 07 1994 - 19:22:32 CET

Original text of this message