开发者

Only want Date portion of DateTime

开发者 https://www.devze.com 2023-02-15 03:02 出处:网络
<%= Model.STPData.InitialRateSettingDate.HasValue ? Model.STPData.InitialRateSettingDate.Value.ToString() : \"\" %>
<%= Model.STPData.InitialRateSettingDate.HasValue ? Model.STPData.InitialRateSettingDate.Value.ToString() : "" %>

This shows both the date and the timestamp. I tried using only the .Date property but it didn't work. How can I remove the time portion and display the date 开发者_开发知识库as a string only?


DateTime has a .ToShortDateString() method

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号