SetDate

FreeBASIC

SetDate
 
Sets the current system date

Syntax

Declare Function SetDate ( ByRef newdate As Const String ) As Long

Usage

result = SetDate( newdate )

Parameters

newdate
the new date to set

Return Value

Returns zero on success or non-zero on failure on all ports except DOS.

Description

To set the date you just format newdate and send to SetDate in a valid format following one of the following: "mm-dd-yy", "mm-dd-yyyy", "mm/dd/yy", or "mm/dd/yyyy" (mm is the month, dd is the day, yy or yyyy is the year.

Example

Dim m As String, d As String, y As String
m = "03" 'march
d = "13" 'the 13th
y = "1994" 'good ol' days
SetDate m + "/" + d + "/" + y


Differences from QB

  • The DATE statement was used in QB and the syntax was "DATE = string"

See also