settingsAccountsettings
Menusettings

Q: Printing out the current date and time in in C#

+4 votes

How to print in C# the current date and time and print it out in console application?

asked in C# category by user Jolie Ann

1 Answer

+2 votes
 
Best answer

After you write Console.WriteLine and open the brackets - you can intuitively start typing Date and Visual Basics will give you some suggestions - including the method for finding out the current date and time...

Here is the code:

using System;

class CurrentDateTime
{
    static void Main()
    {
        Console.WriteLine(DateTime.Now);
    }
}
answered by user matthew44
edited by user golearnweb
thanks, matthew44!
...