C# Getting Current Time

In C# the DateTime.Now property is used to get the current time. We can display time in various formats.

Let's examine the examples below...

namespace ConsoleApplicationTest
    class Program {

        static void Main(string[] args) {

            DateTime dNow  = DateTime.Now;
            string   dNow2 = DateTime.Now.ToString("h:mm:ss");            


You May Interest

C# Finding the Sine of an Angle

Finding Character Count of String in C#

C# Finding the Path to the Windows Folder

C# Example of Sum of Even Numbers from 1 to 100

C# Finding the Computer Name