The DateTime property Now may also be used in VB.Net to get the current date and time.
Assigning the current date and time to the variable startDate:
Dim startDate as DateTime = DateTime.Now
DateTime is found in the Namespace System. To make use of the DateTime functions the System namespace is referenced. this may either be by an import, or per reference.
The example below adds additional formatting of the output, limiting the output to only the date. Note how the System namespace is first imported and the label to be used to illustrate the current date/time is declared:
Imports System
Protected lblStartDate As System.Web.UI.WebControls.Label
lblStartDate.Text = DateTime.Now.ToString(“dd, MMM, yyyy”)


