In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

TimeStamp→日時

タイムスタンプやミリ秒を読める形にしてくれるクラス NumericFormatter
Get Adobe Flash player
by keno42 22 Feb 2010
    Embed
/**
 * Copyright keno42 ( http://wonderfl.net/user/keno42 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/fwZs
 */

// forked from keno42's reactorの便利クラス NumericFormatter
/**
 * タイムスタンプやミリ秒を読める形にしてくれるクラス NumericFormatter
 */
package {
    import flash.display.Sprite;
    import flash.text.*;
    import flash.events.*;
    import flash.utils.*;
    import net.user1.utils.NumericFormatter;
    
    public class FlashTest extends Sprite {
        private var tf:TextField = new TextField;
        private var tfInput:TextField = new TextField;
        public function FlashTest() {
            // write as3 code here..
            addChild(tf);
            tf.autoSize="left";
            tf.y = 25;
            
            addChild(tfInput);
            tfInput.width = 100;
            tfInput.height = 20;
            tfInput.type = "input";
            tfInput.border = true;
            tfInput.text = (new Date()).getTime().toString();
            
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
        private function onEnterFrame(e:Event):void{
            var date:Date = new Date();
            date.setTime( Number( tfInput.text ) );
            var date2:Date = new Date();
            tf.text = "";
            tf.appendText( "入力時刻" + "\n" );
            tf.appendText( date.getFullYear()+"/"+(1+date.getMonth())+"/"+date.getDate()+" "+NumericFormatter.dateToUTCHrMinSec(date) + " ("+ date.getTime() +")"+"\n" );
            tf.appendText( "現在時刻" + "\n" );
            tf.appendText( date2.getFullYear()+"/"+(1+date2.getMonth())+"/"+date2.getDate()+" "+NumericFormatter.dateToUTCHrMinSec(date2) + " ("+ date2.getTime() +")"+"\n" ); 
        }
    }
}