Number of months between 2 dates
Edis, Robert
REdis@Blistex.com
Thu, 4 Sep 2003 13:04:38 -0500
How about something like:
This logic assumes the user input of Date_Begin and Date_End, both in DATE format.
DEFINE d_Yr1 INT = NCONVERT(SUBSTRING(ASCII(Date_Begin),1,4))
DEFINE d_Yr3 INT = d_Yr1 + 1
IF d_Mth1 = 12 ELSE d_Yr1
DEFINE d_Mth1 INT = NCONVERT(SUBSTRING(ASCII(Date_Begin),5,2))
DEFINE d_Mth3 INT = d_Mth1 + 1
IF d_Mth1 < 12 ELSE 1
DEFINE d_Yr2 INT = NCONVERT(SUBSTRING(ASCII(Date_End),1,4))
DEFINE d_Yr4 INT = d_Yr2 - 1
IF d_Mth2 = 1 ELSE d_Yr2
DEFINE d_Mth2 INT = NCONVERT(SUBSTRING(ASCII(Date_End),5,2))
DEFINE d_Mth4 INT = d_Mth2 - 1
IF d_Mth2 > 1 ELSE 12
DEFINE d_Mth_Btwn INT = (d_Yr4 - (d_Yr3 + 1)) * 12
DEFINE d_Tot_Mth = (12 - d_Mth3) + d_Mth_Btwn + d_Mth4
Blue
-----Original Message-----
From: Terry Pickering [mailto:pickering@4j.lane.edu]
Sent: Thursday, September 04, 2003 11:17 AM
To: powerh-l@lists.swau.edu
Subject: Number of months between 2 dates
Does anyone have an algorithm around that would compute the number of full
MONTHS between two dates? Example is the number of months between 7/12/1968
and 10/8/2002.
Thanks!
____________________________
Terry Pickering
= = = = = = = = = = = = = = = = = = = = = = = = = = = =
Mailing list: powerh-l@lists.swau.edu
Subscribe: "subscribe" in message body to powerh-l-request@lists.swau.edu
Unsubscribe: "unsubscribe <password>" in message body to powerh-l-request@lists.swau.edu
http://lists.swau.edu/mailman/listinfo/powerh-l
This list is closed, thus to post to the list you must be a subscriber.