Andrew Milner <[email protected]> writes:

> what you say is correct if dealing with one month ago - but lets now 
> imagine it is say 31 may and we wish to go back 2, 3 or 4 months - where 
> should we end up??

My take is that if someone asks a fuzzy question and gets an answer that
is in the set of arguably reasonable answers, it's ok.  I think that's
far better than throwing an exception.

For going back N months from y/m/d:

  m -= N

  while m < 1, then {y -= 1; m += 12 }

  if ( d is not valid for m )
     move to the 1st of m+1

and call that good enough.

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/rmiwoe38524.fsf%40s1.lexort.com.

Reply via email to