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

后端 未结 30 4021
醉话见心
醉话见心 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条回答
  •  猫巷女王i
    2020-11-22 09:56

    Came across this post when trying to solve the original Q.

    I am using Asp.Net and after some research I have found when you are binding to the value of the date in code behind, you can drop the time so it will not display on screen.

    C#:

    DateTime Today = DateTime.Now;
    

    aspx:

    <%: this.Today.ToShortDateString() %>
    

提交回复
热议问题