Flexcomps’s Weblog

AS3 Undocumented Method Date(String)

Posted by: Yogesh Puri on: September 9, 2008

The Date class constructor is documented with the following parameters in Adobe Docs

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

However today i just tried out and found that there is also a undocumented calling of Date constructor with a Date in a string format. I have tried to pass the date as a string and it converts the Date into a actual Date object of AS3 and you can access all the properties of it.

Following is the statement with a Date Constructor as an input with String parameter

trace(new Date("6/13/2008 8:18:15 AM"));

2 Responses to "AS3 Undocumented Method Date(String)"

Actually it is the help:

If you pass one argument of data type String, and the string contains a valid date, the Date object contains a time value based on that date.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Date.html#Date()

Keep in mind this doesn’t work with a MySQL now(), which has dashes instead of slashes. This only works with a US formatted date.

Leave a Reply

 

September 2008
M T W T F S S
« Aug   Oct »
1234567
891011121314
15161718192021
22232425262728
2930  

Blog Stats

  • 94,229 hits