Ashine
Ashine

Reputation: 4717

Parse string pattern into Date in Flex

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');

Will 'parseDateString' method of dateformatter be useul here?

Thanks in advance.

Upvotes: 2

Views: 2227

Answers (1)

Sai Prasad
Sai Prasad

Reputation: 735

You can use

DateField.StringToDate()

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

Upvotes: 4

Related Questions