ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

VB.Net program to print tomorrow's date

Here, we are going to learn how to print tomorrow's date in VB.Net?
Submitted by Nidhi, on January 19, 2021

Here, we will get and print tomorrow's date using DateTime and TimeSpan class.

Program/Source Code:

The source code to print tomorrow's date is given below. The given program is compiled and executed successfully.

'VB.NET program to print tomorrow's date.

Imports System

Module Module1
    Sub Main()
        Dim today As DateTime = DateTime.Now
        Dim tomorrow As DateTime

        tomorrow = today + New TimeSpan(1, 0, 0, 0)

        Console.WriteLine("Tomorrow : {0}/{1}/{2}", tomorrow.Day, tomorrow.Month, tomorrow.Year)
    End Sub
End Module

Output:

Tomorrow : 19/1/2021
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 two objects of the DateTime class. Here, object today is initialized with the current date using DateTime.Now property and then we add timespan from the object today and get tomorrow's date and print the result on the console screen.

VB.Net Date & Time Programs »



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.