Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Extracting only time and suppressing date in C#

From DateTime format, we can get only time.

using System;

namespace forgetCode
{
    class Program
    {
        static void Main(string[] args)
        {

            DateTime dt = DateTime.Now;

            string Timeonly = dt.ToShortTimeString();

            //Only hour and minute

            Console.WriteLine(Timeonly);
        }

    }
}


Output:
16:04

..