Current Date Without Time with Now property in C#

In this article, I would like to show the Current Date Without Time with Now property in C#.
  • 5252

In this article, I would like to show the Current Date Without Time with Now property in C#. To do that you can use ToString Function with datetime now and today property.

DateTime Now Property

This displays the current date and time of the system, expressed as the local time. In other words the Now property returns a DateTime object that has the date and time values for right now. 

ToString Function

This function is used to convert the value of the current system.datetime object to its equivalent string.

Example

 string TodayDatewithouttime = DateTime.Now.ToString("dd/MM/yyy");

Current Date Without Time in C#

You can do it with the ToString function in C#. The following is simple code for it.

using System;

using System.Collections.Generic;
using
System.Linq;
using
System.Text;

namespace ConsoleApplication71

{
    class
Program

    {

        static void Main(string[] args)

        {

            string TodayDatewithouttime = DateTime.Now.ToString("dd/MM/yyy");

            Console.WriteLine("Today Date without Time: {0}", TodayDatewithouttime);

        }

    }

}


Output

 

 Current-Date-without-time-in-Csharp.jpg

© 2013 dotNetheaven. All rights reserved.