2 Replies Latest reply on Jul 25, 2017 12:24 PM by ClayUUID

    date to display


      I want to create a swf file which displays date in the format Tuesday, July 25, 2017 and updates it with current time

      please suggest me a solution.

        • 1. Re: date to display
          kglad Adobe Community Professional & MVP

          var d:Date;

          var dowA:Array=['Sunday','Monday',etc];

          var moyA:Array=['January','February',etc];

          var t:Timer=new Timer(1000,0;



          function f(e:TimerEvent):void{

          d=new Date();

          tf.text = formatF(d);


          function formatF(d:Date):String{

          return dowA[d.day]+', '+moyA[d.month]+', '+d.fullYear;


          1 person found this helpful
          • 2. Re: date to display
            ClayUUID Adobe Community Professional

            AS3 supports a more direct method for doing this sort of thing.


            function updateDate(evt:TimerEvent):void {
                var d:Date = new Date();
                var df:DateTimeFormatter = new DateTimeFormatter(LocaleID.DEFAULT);
                df.setDateTimePattern("EEEE, MMMM d, yyyy");
                var fd:String = df.format(d);


            DateTimeFormatter - Adobe ActionScript® 3 (AS3 ) API Reference


            As for automatic updating, while you could schedule a timer to fire every 24 hours, the probability of timer drift is high. The function itself is so trivial that there would be no harm in calling it once a minute (every 60,000 milliseconds). So something like...


            var myTimer:Timer = new Timer(60000);
            myTimer.addEventListener(TimerEvent.TIMER, updateDate);