Upon searching on flex documentation, I found parseDateString but the problem is it is a protected method so to resolve this i found a method that may do the trick I needed.
var dateFromString:Date = new Date(Date.parse(stringDate));
Assuming that my stringDate format is Day Mon DD HH:MM:SS TZD YYYY
Here is the documentation for Date.parse for other format:
Date.parse(s:*):Number
Converts a string representing a date into a number equaling the number of milliseconds elapsed since January 1, 1970, UTC.
Parameters:
date A string representation of a date, which conforms to the format for the output of Date.toString(). The date format for the output of Date.toString() is:
Day Mon DD HH:MM:SS TZD YYYY
For example:
Wed Apr 12 15:30:17 GMT-0700 2006
The Time Zone Designation (TZD) is always in the form GMT-HHMM or UTC-HHMM indicating the hour and minute offset relative to Greenwich Mean Time (GMT), which is now also called universal time (UTC). The year month and day terms can be separated by a forward slash (/) or by spaces, but never by a dash (-). Other supported formats include the following (you can include partial representations of these formats; that is, just the month, day, and year):
MM/DD/YYYY HH:MM:SS TZD
HH:MM:SS TZD Day Mon/DD/YYYY
Mon DD YYYY HH:MM:SS TZD
Day Mon DD HH:MM:SS TZD YYYY
Day DD Mon HH:MM:SS TZD YYYY
Mon/DD/YYYY HH:MM:SS TZD
YYYY/MM/DD HH:MM:SS TZD
No comments :
Post a Comment