locked
DateTime.ParseExact problem conversion DateTime RRS feed

  • Question

  • User282826316 posted

    Hello,

    I have to do a conversion of datetime in this format string, for example if I get so

    DateVideo = DateTime.ParseExact("Fri Jun 13 02:46:40 2014", "ddd MMM dd HH:mm:ss yyyy", CultureInfo.CreateSpecificCulture("en-US")); --> OK

    it works,

    if  

    DateVideo = DateTime.ParseExact("Wen Jun 11 16:29:36 2014", "ddd MMM dd HH:mm:ss yyyy", CultureInfo.CreateSpecificCulture("en-US")); --> KO
    It does not work. 

    I do not understand why 

     :( 

    Monday, September 8, 2014 3:46 AM

Answers

  • User-821857111 posted

    DateTime.ParseExact("Wen

    That should be DateTime.ParseExact("Wed

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 8, 2014 3:52 AM
  • User-821857111 posted

    If the date value is being presented to you incorrectly, I recommend using Replace. The only alternative is to speak to whoever generates the date value and see if they can correct their error.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 8, 2014 4:39 AM

All replies

  • User-821857111 posted

    DateTime.ParseExact("Wen

    That should be DateTime.ParseExact("Wed

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 8, 2014 3:52 AM
  • User-1716253493 posted

    Sun - Mon - Tue then Wed (not Wen)

    Monday, September 8, 2014 3:52 AM
  • User282826316 posted

    I read in the file that is written so :( as I do.
    I have not read that I write the file

    Monday, September 8, 2014 3:54 AM
  • User282826316 posted

    Should I do a replace? I do not see many other solutions

    Monday, September 8, 2014 3:55 AM
  • User-821857111 posted

    If the date value is being presented to you incorrectly, I recommend using Replace. The only alternative is to speak to whoever generates the date value and see if they can correct their error.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 8, 2014 4:39 AM