AddMonth()

AddMonth()

Adds or subtracts months to/from a date

Syntax

      AddMonth( [<dDate>,] <nMonths> ) -> dShiftedDate

Arguments

<dDate>Designates the date to which the months is added.

The default is the system date.

<nMonth>Designates the number of months to add to <dDate>.

Returns

AddMonth() returns the new date after <nMonth> is added to <dDate>.

Description

Use this function to calculate payment due dates based on an invoice date and for similar applications. It permits you to add months to a given date. If you use a negative number, months are subtracted.

Note

An empty date parameter will result in an empty date.

Examples

     * Show today's date, plus 36 months:

     ? "The payment period ends on: ", AddMonth(36)

     * Today plus 7 month: 
     ? "AddMonth( 7 ) :", AddMonth( 7 )

     * Date of last day of 7 month after :
     ? "EOM( AddMonth( 7 ) ) :", EOM( AddMonth( 7 ) )

     * Dates of next year: 
     dDate := CTOD( "12.12.2012" )
     ? "Last day of one month after", dDate, ":", EOM( AddMonth( dDate, 1 ) )
     ? "Last day of two month after", dDate, ":", EOM( AddMonth( dDate, 2 ) )

     * Month before 
     ? "Date of two month before", dDate, ":", AddMonth( dDate, -2 )
     ?

Compliance

AddMonth() is compatible with CT3’s AddMonth().

Platforms

All

Files

Source is dattime2.prg, library is libct.

2 responses to “AddMonth()

  1. Pingback: Harbour Date & Time Functions | Viva Clipper !

  2. Pingback: Harbour All Functions – A | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.