Tuesday, September 21, 2010

Visual Basic Date and Time Function : Now

Purpose : The Now function provides the current date and time of the computer system's clock/calendar as date data type.

Syntax :
Now ( )

Option Explicit

Private Sub Timer1_Timer()
'set timer interval
Timer1.Interval = 100
'display the date variant
Text1.Text = Str$ (Now)
'display formatted date and time
Text2.Text = Format$ (Now(), "mmmm-dd-yyyy hh:mm:ss")
End Sub

The Now function has no arguments. the date returned by the Now function represents the system date and time at the moment the code runs.

No comments:

Post a Comment