Date Formatting C#

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

    To see what's wrong, print a DateTime using your fromString:

    DateTime dt = new DateTime(2013, 3, 22);
    string s = dt.ToString(fromFormat);
    

    you'll see that the output is:

    Fri, 22 03 2013 00:00:00 -04:00
    

    so that is the format it would be expecting.

    You might be able to get some help on the abbreviations from this article.

提交回复
热议问题