VB.Net program to demonstrate the MinValue property of DateTime class

Here, we are going to demonstrate the MinValue property of DateTime class in VB.Net.
Submitted by Nidhi, on January 21, 2021 [Last updated : March 07, 2023]

DateTime.MinValue Property in VB.Net

The MinValue property of DateTime is a read only property, which is used to get the minimum value for an object of the DateTime class.

Syntax

Date.MinValue as Date

VB.Net code to demonstrate the example of DateTime.MinValue property

The source code to demonstrate the MinValue property of the DateTime class is given below. The given program is compiled and executed successfully.

'VB.NET program to demonstrate MinValue property of 
'DateTime class.

Imports System

Module Module1
    Sub Main()
        Dim mindate As DateTime

        mindate = DateTime.MinValue

        Console.WriteLine("Minimum date value: {0}", mindate)
    End Sub
End Module

Output

Minimum date value: 01-01-0001 00:00:00
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 DateTime class and then get the minimum supported value for an object of the DateTime class and print that value on the console screen.

VB.Net Date & Time Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.