Introducing Radical.sh

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

Extracting only date and suppressing time in C#

From DateTime format we can get only date.

using System;

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

            DateTime dt = DateTime.Now;

            string dateonly = dt.ToShortDateString();

            Console.WriteLine(dateonly);
        }

    }
}


Output:
21-07-2012

..