开发者

Flex how to format a date string when it could be two different formats

开发者 https://www.devze.com 2023-03-10 18:37 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消