Date formatting yyyymmdd to yyyy-mm-dd

前端 未结 9 1908
长情又很酷
长情又很酷 2020-12-17 00:36

I\'m trying to convert a date in yyyymmdd format to yyyy-mm-dd with the following code:

tdrDate = DateTime.ParseExact(dateString, \"yyyymmdd\", null).ToStrin         


        
9条回答
  •  清酒与你
    2020-12-17 01:11

    Disclaimer I know nothing about C#'s date formatting.

    But I'm guessing the problem is that you used mm in the first format string, and MM in the second.

提交回复
热议问题