A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: XML Time to English Time Format

  1. #1
    Animator
    Join Date
    Jan 2001
    Location
    Dubai
    Posts
    200

    Unhappy XML Time to English Time Format

    Hello all

    I am getting the XML feed and displaying it for every record in Flash, the time format in XML is :

    <Date>2009-03-22T00:00:00.0000000-00:00</Date>
    <Time>1900-01-01T20:00:00.0000000-00:00</Time>
    How to convert that into e.g: 22 March 2009 and 19:00, before displaying it into the dynamic Text Box?

    any help or support will be much appreciated

    Thanks
    Fahad
    [email protected]
    I won't change directions and i won't change my mind, How much difference does it made?

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    PHP Code:
    // parse the <Date> and <Time> nodes to strings

    dStr "2009-03-22T00:00:00.0000000-00:00";
    tStr "1900-01-01T20:00:00.0000000-00:00";

    dStr dStr.substr(0,10); // select first 10 chars - 2009-03-22
    tStr tStr.substr(0,4); // select first 4 chars - 1900

    dArr dStr.split("-");
    /* - produces -
    _level0.dArr = [object #1, class 'Array'] [
        0:"2009",
        1:"03",
        2:"22"
      ]
    */

    // make an array of month names
    mArr = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];

    trace("Date = "+dArr[2]+" "+mArr[dArr[1]-1]+" "+dArr[0]);
    trace("Time = "+tStr); 

  3. #3
    Animator
    Join Date
    Jan 2001
    Location
    Dubai
    Posts
    200
    Thanks a lot modified dog, you rock!!
    [email protected]
    I won't change directions and i won't change my mind, How much difference does it made?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center