how to give format DateTime.Date?

前端 未结 7 647
滥情空心
滥情空心 2021-01-29 10:47

DateTime dt = DateTime.Now dt.Date is created to 31.10.2012 00:00:00 .it is created to dd.mm.yyyy format but i need dd/mm/yyyy. Can i use: return new DateTime(d.Year, d.Month

7条回答
  •  执笔经年
    2021-01-29 11:08

    System.DateTime does not have any format. You can view its string representation in format. Try this

    Console.WriteLine(DateTime.Now.Date.ToString("dd'/'MM'/'yyyy"));
    

提交回复
热议问题