First you will need a DateFormatter
< mx:DateFormatter id = "formatDateTime" formatString = "EEEE, MMM. D, YYYY at H:NN:SS A" /> |
[Bindable] private var time:String;
private var ticker:Timer;
public function showTime():void
{
var currentTime:Date = new Date();
this.time = formatDateTime.format(currentTime);
this.ticker = new Timer(1,1);
this.ticker.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
this.ticker.start();
}
public function onTimerComplete(event:TimerEvent):void
{
showTime();
}
Pattern | Example |
Year | |
YY | 09 (Year Number Short) |
YYY | 2009 (Year Number Full) |
YYYY | 02009 (I have no clue why you would need this) |
Month | |
M | 7 (Month Number Short) |
MM | 07 (Month Number Full) |
MMM | Jul (Month Name Short) |
MMMM | July (Month Name Full) |
Day | |
D | 4 (Day Number Short) |
DD | 04 (Day Number Full) |
Day Name | |
E | 1 (Day Number Short) |
EE | 01 (Day Number Full) |
EEE | Mon (Day Name Short) |
EEEE | Monday (Day Name Full) |
A | AM/PM |
J | Hour in day (0-23) |
H | Hour in day (1-24) |
K | Hour in AM/PM (0-11) |
L | Hour in AM/PM(1-12) |
N | 3 (Minutes) |
NN | 03 (Minutes) |
SS | 30 (Seconds) |
No comments:
Post a Comment