Flex how to format a date string when it could be two different formats
I have a date field in flex and have the format set to YYYY-MM-DD. As long as the user clicks the calendar pop-up it set's it that way.
However, I need to allow the field to be human enter-able so they can type in a date.
The problem is, most users want to type the f开发者_Python百科ormat MM/DD/YYYY. I have a tool tip that shows the format, but how can I check the format and change it to the YYYY-MM-DD format, or do something else appropriate (alert?)?
Easy enough:
DateFormatter.parseDate(yourString);
As long as your string is somewhat of a standard format, it should work.
精彩评论