[comp.databases] Dates and INFORMIX

edd842c@monu6.cc.monash.edu.au (j.e. 8842141 osborn) (10/11/90)

I have a question regarding the computation of the number of
days between dates in Informix.

eg. The number of days between 10-10-90 and 12-11-90

I have searched through the manuals and can't find any Jullian
Date functions etc. 

Is it a case of "write your own" ????



/////////////////////////////////////////////////////////////
Jamie Osborn                  edd842c@monu6.cc.monash.edu.au
/////////////////////////////////////////////////////////////

ray@magic.cs.unlv.edu (Ray Tripamer) (10/12/90)

In article <1990Oct11.060258.280@monu6.cc.monash.edu.au> edd842c@monu6.cc.monash.edu.au (j.e. 8842141 osborn) writes:
>I have a question regarding the computation of the number of
>days between dates in Informix.
>
>eg. The number of days between 10-10-90 and 12-11-90
>
>I have searched through the manuals and can't find any Jullian
>Date functions etc. 

Informix dates are stored internally as integers.  Specifically (from the
Informix-SQL Reference Manual V2.10) Informix "stores a DATE value as an
integer whose value is the December 31, 1899".

Therefore all you need to do to get the number of dates is to subtract
the two date fields, i.e. (in an ACE report):

			PRINT date1-date2;

where "date1" and "date2" are two date fields from the select statement.
--
Ray Tripamer
ray@jimi.cs.unlv.edu

markj@informix.com (Mark Jeske(Chicago Consultan)t) (10/13/90)

In article <1990Oct11.060258.280@monu6.cc.monash.edu.au> edd842c@monu6.cc.monash.edu.au (j.e. 8842141 osborn) writes:
>I have a question regarding the computation of the number of
>days between dates in Informix.
>
>eg. The number of days between 10-10-90 and 12-11-90
>
>I have searched through the manuals and can't find any Jullian
>Date functions etc. 

Date types can simply be subtracted to get the number of days between
them.  They are simply stored as integers.  for example:


  main
    define
      d1,d2   date,
      dif     integer

    let d1 = "10-10-90"
    let d2 = "12-11-90"
  
    let diff = d2 - d1
    display diff
  end main

gives  61


Mark Jeske (Chicago consulting)
markj@infmx.com