<cDateTime>.AddYears

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Language > thinBasic Functions > Date and Time > cDateTime > cDateTime_Methods >

<cDateTime>.AddYears

 

Description

 

Adds the specified number of years to the value of this cDateTime object.

You can subtract by using a negative number.

 

Syntax

 

<cDateTime>.AddYears(nYears)

 

Returns

 

None.

 

Parameters

 

Name

Type

Optional

Meaning

nYears

Numeric

No

Positive or negative years to add or subtract

 

Remarks

 

Restrictions

 

See also

 

Examples

 

' Create an object with current date and time

Dim myDateTime As New cDateTime

 

' Original form

MsgBox 0, "myDateTime:" + $CRLF + myDateTime.toString

 

' Modify the date

myDateTime.AddYears(4)

 

' Modified form

MsgBox 0, "myDateTime modified:" + $CRLF + myDateTime.toString