I\'m storing Date in datetime
column of MySQL table. I\'m inserting current date by calling MySql\'s UTC_CURRENTDATE. When I retrieve it, it\'s in following string
Although I'm sure there's a more elegant approach; clearly you could implement a parse function such as:
public static function parse(date:String):Date
{
var split:Array = date.split(" ");
var splitDate:Array = split[0].split("-");
var splitTime:Array = split[1].split(":");
return new Date(splitDate[0],
splitDate[1] - 1,
splitDate[2],
splitTime[0],
splitTime[1],
splitTime[2]);
}
Called as:
var date:Date = parse("2012-07-24 12:59:58");
Instead of handling MySQL DATETIME
, your SQL statements could convert to timestamps which ActionScript Date
constructor would accept milliseconds since epoch.
Frameworks such as CASA Lib have nice date utility functions.