Format date yymm based on number of months.

mrenshaw

Registered User.
Local time
Today, 04:04
Joined
May 3, 2002
Messages
27
I am importing data to a program that requires the life of an item. This is in months such as 241 months. The valid format for this program is YYMM. 241 = 2001 or 20 years 01 month.

Another example: 16 months should read 0104 or one year 4 months.

Any idea how to convert this to yymm format based on the number of months?

thanks in advance.
 
Format([NumberOfMonths]\12, "00") & Format([NumberOfMonths] Mod 12, "00")
.
 
Thanks

Thanks Jon, works perfect!! I didn’t have a clue about Mod 12. Very much appreciated.
 
Mod returns whats left over after the devision...

13 mod 12 returns 1 for 13 - (1*12) = 1

26 mod 12 returns 2 for 26 - (2*12) = 2

Get it?
 
Got it! Thanks for the info namliam. Thank you both for your time. Very much appreciated.
 

Users who are viewing this thread

Back
Top Bottom