Search code examples
actionscript-3flashdategetdate

AS3 Flash: getTime value to Date?


Is there a way to convert date.getTime() value to the Date? I mean, like this:

1377564829609 ----> Mon Aug 26 21:53:49 GMT-0300 2013

Thanks in advance.


Solution

  • Try this

    var time:Number = 1377564829609;
    
    var date:Date = new Date(time);
    

    The Date class contructor

    public function Date(yearOrTimevalue:Object, month:Number, date:Number = 1, hour:Number = 0, minute:Number = 0, second:Number = 0, millisecond:Number = 0)
    

    And the adobe doc said like this

    yearOrTimevalue:Object —  If other parameters are specified, this number represents 
    
    a year (such as  1965);  otherwise, it represents a time value.