Note I need to be able to add any number of months and I need to take into account leap years. My approach to this problem would begin with having a routine that determines if a given day is the last day of the month (taking into account leap year Februaries of course! Month); Date Time new Month = new Date Time(working Month. Month, next Month Days); If you need only End Of Month or simple Add NMonth, then you have got your answer already.Also I know the logic here is questionable but it is a business requirement that works with end of month contracts going to the end of the month for a month in the future. ) You'll also need a routine that gives you the last day of a month, given a day in that month. Otherwise, to have a complete generic solution you would need an implementation of the Recurrence pattern as you may see it in the UI of the Outlook Meeting interface.arrangement whereby all purchases made through the 25th of one month are payable within 30 days of the end of the following month.
Then, finally, I subtract one from that date to convert 1/1/2002 to 12/31/2001. for this out-of-the-box answer, which will also work:=DATE(YEAR(E1),1 MONTH(E1),0)It is unusual to consider the "0th" of a month, but it works!
For example, an invoice that is marked 2/10, n/30 EOM lists a cash discount, net payment terms, and a specific payment date.“2/10” refers to the cash discount.
If the invoice is paid within the first ten days after receiving it, the seller will discount the order by 2 percent.
So, December 13 2001 could be entered as =DATE(2001,12,13). If you specify an invalid number of months, such as 13, it will give the correct date. This makes it a great function when you need to add or subtract to the current date.
In solving this problem, it is easier to find the first day of the next month and then subtract one day.