Parsing a complicated string as DateTime

前端 未结 1 1489
时光取名叫无心
时光取名叫无心 2021-01-14 12:51

Can someone tell me how should I approach converting the following format to a proper DateTime object?

11:50:46 AM on Wednesday, October 19, 201         


        
1条回答
  •  清酒与你
    2021-01-14 13:11

            string s = "11:50:46 AM on Wednesday, October 19, 2011";
            DateTime dateTime = DateTime.ParseExact(s, 
                "hh:mm:ss tt on ffffdd, MMMM dd, yyyy", CultureInfo.InvariantCulture);
    

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