Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Toby Denbow — — source: Informix-list mailing list archive (1991-1998)
How can I get the number of months that seperate two dates.
For example: If I have two dates
Date 1 = 8/27/90
Date 2 = 8/27/80
How do I subtract date 2 from date 1 and come up with the number 120 months.
I also need it to work for negative #'s also. IE. subtract date 1 from
date 2 and come up with -120 months.
I came up with the following SQL that works, but there must be a better
way to do this?
((year(date (8/27/90))-year(date (8/27/80 )))*12) +
(month(date (8/27/90))-month(date (8/27/80 )))
Please reply via email if possible.
Thank you,
Toby Denbow
tdenbow@mathworks.com
== Toby Denbow ========================= tdenbow@mathworks.com ==
The MathWorks, Inc. info@mathworks.com
24 Prime Park Way http://www.mathworks.com
Natick, MA 01760-1500 ftp.mathworks.com
==== Tel: 508-647-7243 ==========================================
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.