2 Replies Latest reply on Jul 24, 2008 11:51 AM by Gregory Lafrance

    Different date format

    Jihaes
      I wasnt able to find a whole lot of discussions on different date format.
      Is there a built in function that can read date format by locale setting? There are dates that are formatted like
      "YYYY-MM-DD", "DD-MM-YYYY" and it seems like these with "-" aren't liked by parseFunction.

      Would I just have to figure out what locale system setting is and try to figure out the format to parse it in the "/" format?
        • 1. Re: Different date format
          Jihaes Level 1
          var formatter:DateFormatter = new DateFormatter();
          formatter.formatString = "MM/DD/YYYY";
          dateinString = formatter.format("2008-7-10");

          This seem to work great.
          But what happens with locale settings where it's DD-MM-YYYY
          will it recognize if it is 10-12-2008 (will it know it's 10 for day and 12 for month?)

          just curious
          • 2. Re: Different date format
            Gregory Lafrance Level 6
            If I am not mistaken, when you develop your app you need to know the format of any data that will be accessed, and then brought into the application UI.

            Then in your UI code you can use the formatters to format the data based on the current locale.

            If you cannot reliably know the meaning of the data accessed by the app "MM/DD/YYYY" or "DD/MM/YYYY", then you cannot hope to reliably display it accurately in various locales in the UI.