Parsing a complicated string as DateTime

折月煮酒 提交于 2019-12-19 09:56:42

问题


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, 2011

回答1:


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


来源:https://stackoverflow.com/questions/11433480/parsing-a-complicated-string-as-datetime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!