Date Formatting C#

前端 未结 7 1346
生来不讨喜
生来不讨喜 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:30

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

提交回复
热议问题