How to exclude seconds from DateTime.ToString()

前端 未结 7 510
逝去的感伤
逝去的感伤 2020-12-09 16:26

I am using DateTime.Now.ToString() in a windows service and it is giving me output like \"7/23/2010 12:35:07 PM \" I want to exclude the second part, displaying only up to m

相关标签:
7条回答
  • 2020-12-09 17:07

    Try DateTime.Now.ToShortDateString() + " " + DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString()

    0 讨论(0)
提交回复
热议问题