How to remove time portion of date in C# in DateTime object only?

后端 未结 30 4018
醉话见心
醉话见心 2020-11-22 09:08

I need to remove time portion of date time or probably have the date in following format in object form not in the form of string.

         


        
30条回答
  •  臣服心动
    2020-11-22 09:52

    If you are converting it to string, you can easily do it like this.

    I'm taking date as your DateTime object.

    date.ToString("d");
    

    This will give you only the date.

提交回复
热议问题