#431 DateTime class fromOrderedDate

3.2.0
closed
Rick McGuire
Classes (182)
5
2012-08-14
2007-10-08
Lee Peedin
No

Hope I'm not speaking too quick here, but all tests of the DateTime methods I've tested so far return the value as YYYY-MM-DD (I started at the top)

If that is the case, then fromOrderedDate mis-interprets the values of date('o')

Lee

Arguments


Code
say date('o')
say .datetime~fromOrderedDate(date('o'))


Says
07/10/08
2008-10-07T00:00:00.000000


Results


Errors/Information
All Data Is On ClipBoard


Discussion

  • Rick McGuire
    Rick McGuire
    2007-10-08

    Logged In: YES
    user_id=1125291
    Originator: NO

    Hmmm, there's definitely something bad going on here, but I haven't spotted where things are going wrong yet. This appears to be creating the DateTime object for the previous day, not the input day.

    However, that's not your question. The from* methods all return a DateTime object. If you say a DateTime object, it will display its string value, which is always the ISO format. Those methods don't return formatted strings.

     
  • Rick McGuire
    Rick McGuire
    2007-10-08

    Logged In: YES
    user_id=1125291
    Originator: NO

    Committed revision 893.

    Accidentally miscoded the 'E' format for the conversion. That made it appear to be the wrong date. If you'd have tried this yesterday, I might not have noticed because it would have produced the correct result :-)

     
  • Lee Peedin
    Lee Peedin
    2007-10-08

    Logged In: YES
    user_id=1223125
    Originator: YES

    Look very close Rick,
    It's not yesterday it's returning
    It's using the last 2 digits of date('o') as the year when it's really the day
    It's using the first 2 digits of date('o') as the day when it's really the year
    It's using the middle 2 digits of date('o') correctly

    Lee

     


Anonymous


Cancel   Add attachments