LCM ???

1. Che
Senior Member
Join Date
Dec 1969
Posts
303

## LCM ???

I am trying to get the number of years and Months between two dates (between 7/21/1993 and todays date from System). How can i get the Years and numbers? I know using LCM (Lowest Common Multiplier)i can get this, but not sure about using VBScript. help me to get XX number of Years and XX number of Months

2. Senior Member
Join Date
Dec 1969
Posts
11,334

## Check out DateDiff() <nm>

boo

3. Senior Member
Join Date
Dec 1969
Posts
2,050

## DateDiff

will do this for u.

4. Che
Senior Member
Join Date
Dec 1969
Posts
303

## RE: DateDiff

Thanks for your response.<BR>YES, i used "DateDiff"<BR><BR>YRRR = DateDiff("yyyy", Date, SvDt) <BR>I got the correct number of Years using this and i used <BR>Mo = DateDiff("m", Date, SvDt) Here i am getting the total months like 119. I need like 9 Years 11 Months...<BR>

5. Senior Member
Join Date
Dec 1969
Posts
11,334

## Check out the MOD operator <nm>

boo

6. Che
Senior Member
Join Date
Dec 1969
Posts
303

## RE: Check out the MOD operator <nm>

Thank You... BUT .... :(:( still needs help...<BR><BR>Mo = DateDiff("m", Date, SvDt) &#039; SvDt = 5/17/1991<BR>YRRR = DateDiff("yyyy", Date, SvDt) <BR><BR>I need to display 12 Years and 1 Month (between 5/17/1991 and Todays Date)<BR><BR>I am displaying 145 Months and 12 Years...<BR><BR>Is there any way that i can get 12 Years and 1 Month??? <BR><BR>You told me to use "mod" Operator!!!!<BR><BR>TYM = ???? (Mo Mod 12) I am not sure... Help me<BR>

7. Senior Member
Join Date
Dec 1969
Posts
115

## RE: Check out the MOD operator <nm>

u answered ure own question... <BR>(Mo Mod 12)<BR>145/12=12 REMAINDER 1 ;)

8. Senior Member
Join Date
Dec 1969
Posts
96,118

## Forget the DIFF of years!

Mo = DateDiff("m", Date, SvDt)<BR>Response.Write (mo 12) & " years and " & (mo MOD 12) & " months."<BR><BR>Yes, that really is a backwards slash! (That&#039;s VBS&#039;s "integer divide" operator.)<BR><BR>You did notice, I hope, that the answer is inaccurate. There really are *NOT* 12 years and 1 month between 5/17/1991 and today. It&#039;s really only 12 years 0 months 19 days. But you are seeing how DateDiff works. If that&#039;s accurate enough for you, go for it.<BR><BR>To illustrate more clearly:<BR> DateDiff("m", #5/31/2003 11:59:59 PM#, #6/1/2003 0:00:01 AM#) <BR>is 1, even though only *two seconds* have elapsed!<BR><BR>Hokay?<BR><BR><BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•