Navigation:  Reference > Functions >

INCMONTH()

Print this Topic Previous pageReturn to chapter overviewNext page

INC_MONTH(1,2)

 

PURPOSE

 

This function will increment (add) or decrement (subtract) a number of months to a date.

 

PARTS

 

1. f/c/e         Required: - the base date, must be of D type.

2. f/c/e         Required: - the number of months you wish to add or subtract (Defaults 1)

 

 

RETURN TYPE - D

 

The date returned depends on the user's regional date setting (so international date settings are recognized).  So if a date in  MM/DD/YYYY format will be returned in the same way.

 

NOTE:  your regional date settings are read when the EXE first loads.  If you change those settings while TASPRO7.EXE or TASRUNTIME.EXE is running, you will need to exit and restart your application before the change can be properly read.

 

COMMENTS

 

If the day of base date is greater than the day of the date to be returned, the day is set to the last day of the returned month.   Example:  if you add one month to an October 31 date, a November 30 date will be returned.

 

With this function you can also easily add or subtract years from a date simply by multiplying the second parameter by 12.

 

EXAMPLE

 

define startdate,endDate type D size 8

//must be defined as a type N in TAS if you plan to decrement

define incamt_n Type n size 4

startdate = date()

//add 18 months to the startdate and put the result into enddate

incamt_n = 18

enddate = Inc_Month(startdate,incamt_n)

//add 10 years to startdate instead

Startdate = date()

incamt_n = 120

enddate = Inc_Month(StartDate,incamt_n)

 

SEE ALSO

DATE()   Convert to time CTOT()   TIME GET SET  Convert time to record TTOR()  Covert time to number TTOF() Convert time to string TTOC()

TIME() YEAR() Date Command  Date to Record DTOR()  Convert date to Character DTOC() Days in month DAY_IN_MONTH

Increment the Month INC_MONTH DayMonthyear DMY()  Month Day Year MDY()

Convert to Date CTOD() Charicter of month CMNTH()  Charicter to day of week CDOW()

 

 


Page url: http://www.cassoftware.com/tas/manual/incmonth.htm