Date type is used to represent date, time and
both date and a time with values ranging from 12:00:00 midnight, January 1, 0001
C.E. (Common Era) to 11:59:59 P.M., December 31, 9999 C.E. . Date part
represents only date, month and year between 1/1/1 to 31/12/9999. Time part
represents time of a day in millisecond unit. Time value can be either negative
or positive.
Code:
Module Module1
Sub Main()
Dim d1 As New Date(2010,
7, 11)
Console.WriteLine("Date
Time 1 : {0}", d1)
Console.WriteLine()

'Date time using String Format.
Console.WriteLine("Date
Time 1 without time: {0:d}", d1)
Console.WriteLine()
'Date time using String Format.
Dim format
As String =
[String].Format("{0:d}",
d1)
Console.WriteLine("Date
Time 1 without time: {0}", format)
Console.WriteLine()
Dim d2 As New Date(2010,
7, 11, 12, 30, 45)
Console.WriteLine("DateTime
2: {0}", d2)
Console.WriteLine()
Dim d3 As New Date(2010,
7, 11, 12, 30, 45,10)
Console.WriteLine("DateTime
3: {0}", d3)
Console.WriteLine()
Dim d4 As New Date(2010,
7, 11)
Console.WriteLine("dt1:
{0}", d4)
Console.WriteLine()
Dim Yesterday
As Date = GetYesterdayDateTime()
Console.WriteLine("Yesterday:
{0}", Yesterday)
Console.WriteLine()
Dim Morrow As Date = GetTomorrowDateTime()
Console.WriteLine("Tomorrow:
{0}", Morrow)
Console.ReadLine()
End Sub
Private
Function GetYesterdayDateTime() As Date
Return
Date.Today.AddDays(-1)
End Function
Private
Function GetTomorrowDateTime() As Date
Return
Date.Today.AddDays(1)
End Function
End Module
Output

