Home »
VB.Net »
VB.Net Programs
VB.Net program to demonstrate the MaxValue property of DateTime class
By Nidhi Last Updated : November 11, 2024
DateTime.MaxValue Property in VB.Net
The MaxValue property of DateTime is a read-only property, which is used to get the maximum value for an object of the DateTime class.
Syntax
Date.MaxValue as Date
VB.Net code to demonstrate the example of DateTime.MaxValue property
The source code to demonstrate the MaxValue property of the DateTime class is given below. The given program is compiled and executed successfully.
'VB.NET program to demonstrate MaxValue property of
'DateTime class.
Imports System
Module Module1
Sub Main()
Dim maxdate As DateTime
maxdate = DateTime.MaxValue
Console.WriteLine("Max date value: {0}", maxdate)
End Sub
End Module
Output
Max date value: 31-12-9999 23:59:59
Press any key to continue . . .
Explanation
In the above program, we created a module Module1 that contains the Main() function. The Main() function is the entry point for the program.
In the Main() function, we created a reference of the DateTime class and then get the maximum supported value for an object of the DateTime class and print that value on the console screen.
VB.Net Date & Time Programs »