How to put actual date into C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to put actual date into C#

Hey, I’m creating an algorithm what will calculate days till birthday but I do not know how to get real date. Can you help me?

20th Mar 2019, 3:24 PM
Marcin Gardy
Marcin Gardy - avatar
1 Answer
+ 9
Use this to get current date in MM/DD/YYYY: Console.WriteLine( DateTime.Today.ToString("d") ); You can also visit https://docs.microsoft.com/en-us/dotnet/api/system.datetime.today?view=netframework-4.7.2
20th Mar 2019, 3:31 PM
VEDANG
VEDANG - avatar