A simple way to parse dates from different formats could be to define the 
pattern as RB property and then use that property by DateFormat.

Giuseppe

Sent from Samsung Mobile

 Harbs <[email protected]> wrote: 


Funny that I need the same functionality at the same time…

I actually need to parse a date from an unknown format. This is obviously much 
more complex, because something like 1/2/14 could mean either January 2 or 
February 1 depending on the locale.

I do think this type of functionality belongs in DateFormat.

Harbs

On Feb 1, 2014, at 8:10 PM, Christofer Dutz wrote:

> Hi Hemadri,
> 
> Thanks for that pointer. Seems to be what I've been looking for.
> 
> How about integrating this functionality into the DateFormat class ... for me 
> this seems to be the most natural place to have it?
> 
> Chris
> 
> -----Ursprüngliche Nachricht-----
> Von: Hemadri Seelamsetty [mailto:[email protected]] 
> Gesendet: Samstag, 1. Februar 2014 17:49
> An: [email protected]
> Betreff: Re: Simple way to parse I18N dates?
> 
> Chris,
> 
> You can also use the static methods of mx.controls.DateField Class.
> 
> Below are the signatures of the static methods
> 
> DateField.dateToString(value:Date, outputFormat:String):String 
> DateField.stringToDate(valueString:String, inputFormat:String):Date
> 
> Example: var dob:Date = DateField.stringToDate("02/01/2014", "MM/DD/YYYY");
> 
> It can contain "M","D","Y", and delimiter and punctuation characters
> 
> 
> --
> Hemadri <http://hemadri.com>
> 
> 
> 
> On Sat, Feb 1, 2014 at 7:17 PM, Christofer Dutz
> <[email protected]>wrote:
> 
>> Hi,
>> 
>> I am currently sort of stuck with implementing some functionality.
>> 
>> I know I can use a DateFormatter to define a formatted string from a 
>> given date, but I couldn't actually find something for the other way around.
>> The Java equivalent usually has a "parse" and a "format" method 
>> allowing to read a date from a string and to return a date and a 
>> format to serialize a date to a desired output format. It seems the 
>> Flex version is missing the parse part ... What do I have to use for this?
>> 
>> Chris
>> 

Reply via email to