Date Formatting C#

前端 未结 7 1347
生来不讨喜
生来不讨喜 2021-01-27 08:32

I am having an issue converting this date format into another format. I was hoping that somebody on here would be able to help me out.

Here is my code:

s         


        
7条回答
  •  孤独总比滥情好
    2021-01-27 09:27

    22 03 2013 00:00:00 GMT is not Monday it's Friday

    try

                string fromFormat = "ffffd, dd MM yyyy HH:mm:ss zzz";
                string toFormat = "yyyy-MM-dd";
    
                Console.WriteLine(DateTime.ParseExact("Fri, 22 03 2013 00:00:00 +00:00", fromFormat,
                                 CultureInfo.InvariantCulture).ToString(toFormat));
    

提交回复
热议问题