DateSerial Function In VB.NET

How to use DateSerial Function?


DateSerial Function

DateSerial Function in Visual 2008 returns an date value for the specified year, month and day with the time set to the midnight. If the month value is '0' or '-1' the month december or november of the previous year is taken.
If the month value is '1', january month of the calculated year is taken, if '13' january of the following year is taken.

If the Day value is '1' refers to the first day of the calculated month, '0' for the last day of previous month, '-1' the penultimate day of the previous month.


Module Module1
Sub Main()
Dim a As Date
a = DateSerial(2010, 2, 21)
End Sub
End Module

2/21/2010 12:00:00 AM

In the above DateSerial Function example, the date value entered is displayed with the time set to the midnight using the DateSerial().

Visual Basic Tutorial

Ask Questions

Ask Question