Thursday, December 1, 2016

Adding Months to A Given Date

Adding Months to a Given Date

There is a new feature in Suprtool 5.8.10 and higher which allows a user to add a number of months to a give date. Let's say you have to follow up with a customer in three months, a simple Suprtool task can do this:

base custdb,1,;
get customers
if custno="12345"
item follow-up-date,date,ccyymmdd
ext follow-up-date=$month(follow-up-date,+3)

This was done due to a direct request from one of our customers. One of the features of this is that if a month does not have the same number of days, Suprtool will find the closest date. For Example, if the +1 is invoked for a date that is say August 31st, the resulting date would be "September 31", which is of course incorrect. Suprtool will adjust the date to be a correct date of September 30th.

No comments:

Post a Comment