解析字符串模式到Flex中日期 [英] Parse string pattern into Date in Flex

查看:127
本文介绍了解析字符串模式到Flex中日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有某种方式在弯曲的解析字符串的日期。我希望它支持自定义格式类似于'dateformatter。使用dateformatter级所指定的formatString属性,我们可以分析Date对象在不同的​​字符串格式。我想这轮其他的方式,从字符串到日期。解析方法Date.parse(my_string)做字符串解析,但一组的格式非常有限。我们不能有类似以下内容,其中用户可以指定他/她自己的格式的东西。

Is there some way in flex to parse strings to date. I want it to support custom formats similar to 'dateformatter'. Using 'dateformatter' class we can parse date object in various string formats as specified by 'formatString property'. I want it other way round, from string to date. The parse method 'Date.parse(my_string)' does string parsing but for a very limited set of formats. Can't we have something similar to following, where user can specify his/her own formats.

someformatter.formatString = 'HH::MM::SS' ;
mydate = someformatter.formatTodate('23::56:34');

将dateformatter的parseDateString'方法是useul这里?

Will 'parseDateString' method of dateformatter be useul here?

在此先感谢。

推荐答案

您可以使用

DateField.StringToDate()

这是DateField类的静态函数,并返回Date对象。

This is static function of DateField class, and returns Date object.

这篇关于解析字符串模式到Flex中日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆