<cDateTime>.NewDate

<< Click to Display Table of Contents >>

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

<cDateTime>.NewDate

 

Description

 

Specifies new date component for given cDateTime object.

 

Syntax

 

<cDateTime>.NewDate(year [, month [, day]])

 

Returns

 

None.

 

Parameters

 

Name

Type

Optional

Meaning

year

Numeric

No

Year component of date as number 1601 - 30827.

 

month

Numeric

Yes

Month component of date as number 1 - 12.

 

If not specified, 1 is presumed.

 

day

Numeric

Yes

Day component of date as number 1 - 31 (in applicable months).

 

If not specified, 1 is presumed.

 

 

Remarks

 

Restrictions

 

Should any of the assigned values be outside of required range, the cDateTime object will remain unchanged.

 

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 to Back to the Future day :)

' TIME will not be altered ;)

myDateTime.NewDate(2015, 10, 21)

 

' Modified form

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