Snippet – Converting yyyy-mm-ddThh:mm:ss.mssZ to Date()

3 actionscript,as3,as3 tutorials,flash,webservices  |   May 28, 2010  |     2132


So, in dealing with the Google Data API most dates use the format above. Here is a regular expression to decompose it:

Now remember that the constructor for the Date object is quite a pain. It considers Januaray to be month 0, and the first day of the month to be the zero’th day of the month.. With this in mind, you can construct the Date object.

Now, switch to the time-zone of the user..

That’s it folks!

  • July 17, 2010 at 1:36 pm


    Thanks, looking for some time for this

  • November 25, 2010 at 9:38 am


    Hey Mart!
    How are you doing?
    It’s Mathieu C. from New World!

    Nice stuff you did for the GData!

    By the way there a small error in your date parsing it should be:
    var time:Date = new Date(res[1], res[3] – 1, res[4] , res[5], res[6], res[7], res[8]);
    day are from 1-31

    Do you any GData API that can post to youtube (comments, ratings)?

    See ya!

  • November 26, 2010 at 8:29 am


    Salut Mathieu,

    if you download the youtube data api from source (subversion), you’ll notice there is code to post also. Not all the functionality is implemented however. You can even upload videos to youtube using the API, but because the response (304 if I remember well) doesn’t work on Safari for Mac I didn’t post anything about it. It works like a charm on all other browsers that I tested however.

    Look for YoutubeData in there, it should help. 😉

Leave a Reply