Getting the current time is easy in AS3 with the Date() class, however the default clock is the 24 hour (military) clock.
Start by creating a new Date object:
var myDate:Date = new Date();
The Date class allows you to get to the month, day, hours, minutes, seconds and other Date-based information. If we try to trace out the time like this:
trace(myDate.hours + “:” + myDate.minutes + “:” + myDate.seconds);
We’ll get 16 for the hours at 4 pm. The solution is really simple. Just subtract 12 from the hours to get the 12 hour hour.
trace(myDate.hours – 12 + “:” + myDate.minutes + “:” + myDate.seconds);
Cool!ActionScript, AS3, Flash