当日期字符串可能是两种不同的格式时,Flex 如何格式化日期字符串
我在 Flex 中有一个日期字段,并将格式设置为 YYYY-MM-DD。只要用户单击日历弹出窗口,它就会这样设置。
但是,我需要允许该字段可供人类输入,以便他们可以输入日期。
问题是,大多数用户希望键入 MM/DD/YYYY 格式。我有一个显示格式的工具提示,但如何检查格式并将其更改为 YYYY-MM-DD 格式,或者执行其他适当的操作(警报?)?
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 format 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:
As long as your string is somewhat of a standard format, it should work.