Date problem

A

Alec M1BNK

I need to calculate the number of months between two dates. I receive a date
of purchase in the form YYww (2 digit year followed by two digit week number)

It would be nice if I could get the date of the first day of week 10 1998
for example from 9810. I've converted date() into week and year, and thus
calculated the number of weeks difference, and years difference, but months
difference eludes me. I could go with a straightforward months=weeks/4.33 but
since the calculation will determine if something is or is not in warranty,
and thus who pays for its repair, I am persuing something a little more
accurate.

I've been trawling web and forums, but I seem to only find ways of
calculating the week number

Thanks in advance for your help
 
T

Tim Ferguson

I need to calculate the number of months between two dates.

MonthsDiff = 12*(Year(Date2)-Year(Date1)) _
+ Month(Date2) - Month(Date1) _
- (Iif(Day(Date2)<Day(Date1), 1, 0)

I receive
a date of purchase in the form YYww (2 digit year followed by two
digit week number)

Date1 = DateSerial(yy, 1, 7 * ww)


Hope that helps


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top