DateTime.Today Vs DateTime.Now
What is difference between DateTime.Today and DateTime.Now? Here we will see examples of (VB.Net) and (C#.net)
[C#] example of DateTime Today
using System;
namespace DateAndTime.Examples
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Today using DateTime.Today is {0}", DateTime.Today);
Console.WriteLine("Today using DateTime.Now is: {0}", DateTime.Now);
Console.ReadLine();
}
}
}
(VB.net) Example of DateTime Today
Namespace DateAndTime.Examples
Class Program
Private Shared Sub Main(args As String())
Console.WriteLine("Today using DateTime.Today is {0}", DateTime.Today)
Console.WriteLine("Today using DateTime.Now is: {0}", DateTime.Now)
Console.ReadLine()
End Sub
End Class
End Namespace
Output
Today using DateTime.Today is 1/1/2012 12:00:00 AM.
Today using DateTime.Now is: 1/1/2012 6:29:42 PM.
Description
As you can see in output DateTime.Today only gives today's date and default time as 12:00:00. DateTime.Now gives current time of running thread with today's date.
DateTime Examples
How to format Time in C#.net and VB.net program.
DateTime Time Format string {HH:mm:ss}.
C#.net datetime Culture.
C#.net DateTime Month.
string was not recognised as a valid datetime
Get Today
DateTime in English UK format
Get Day Of year
Currently rated 5.0 by 1 people
- Currently 5/5 Stars.
- 1
- 2
- 3
- 4
- 5