You need to retrieve the current date and time.
Use the DateTime.Now shared property.
DateTime.Now retrieves the current date and time as a DateTime structure. You can then retrieve specific date information from its properties, such as Month, Day, Date, Hour, Millisecond, and even DayOfWeek.
Dim Now As DateTime = DateTime.Now Console.WriteLine("The current date is: " & Now.ToString()) Console.WriteLine("It's a " & Now.DayOfWeek.ToString())
The output for this code is as follows:
The current date is: 2002-10-31 5:24:14 PM It's a Thursday
If you want to retrieve only the date portion of the current day, you can use the DateTime.Today shared method. The time portion will be set to 12:00 AM (00:00:00). ...