[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

AS3/XML convert xml timestamps into an hourly time for display in Flash

Posted on 2009-06-30
2
Medium Priority
?
387 Views
Last Modified: 2013-11-11
I need to convert this xml node into standard 24 hr time.  For example: DepartureDate="2009-06-30 15:00" needs to be displayed as 3:00P or something similar.  How do I go about accomplishing this?

Thanks for all the support, this is drivin me nuts!

XML:
<fh:FlightHistory FlightHistoryId="163871394" DepartureDate="2009-06-30 15:00" ArrivalDate="2009-06-30 16:35" PublishedDepartureDate="2009-06-30 15:00"
 
AS3 xml path into parsed dynamic textfields:
Flights.flight_mc.schedTime_txt.text = contentInput.channel.item.someNamespace::FlightHistory[0].@DepartureDate;

Open in new window

0
Comment
Question by:cubical38
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 37

Accepted Solution

by:
CyanBlue earned 2000 total points
ID: 24755856
You basically have to do a simple math like this...

CyanBlue
var timeStr:String = "2009-06-30 15:00";
var dt:String = timeStr.split(" ")[0];
var hr:String = timeStr.split(" ")[1].split(":")[0];
var mn:String = timeStr.split(" ")[1].split(":")[1];
var ampm:String = "AM";
 
if (parseInt(hr) > 12)
{
	ampm = "PM";
	hr = (parseInt(hr) - 12).toString();
}
 
var newTimeStr:String = dt + " " + hr + ":" + mn + " " + ampm;
trace("newTimeStr = " + newTimeStr);     // newTimeStr = 2009-06-30 3:00 PM

Open in new window

0
 

Author Closing Comment

by:cubical38
ID: 31598545
Perfection!  Thank you!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question