forked from: 1桁の月や日を0Xの形に
http://www.project-nya.jp/modules/weblog/details.php?blog_id=432
野中先生方式。
/**
* Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3dDy
*/
// forked from zahir's 1桁の月や日を0Xの形に
package {
import flash.text.TextField;
import flash.display.Sprite;
public class FlashTest extends Sprite {
public function FlashTest() {
// write as3 code here..
var d:Date = new Date();
var month:String = o2t( String( d.getMonth() + 1 ) );
var date:String = o2t(String(d.date));
var full:String = String(d.fullYear) + month + date;
(addChild( new TextField() ) as TextField).appendText( full );
}
private function o2t( str:String ):String
{
return ("0" + str).substr(-2);
}
}
}