forked from: 1桁の月や日を0Xの形に
100で割る→1桁なら0.0X、2桁なら0.XXになる
→substr()で下2桁を取得。
/**
* Copyright Nicolas ( http://wonderfl.net/user/Nicolas )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/eHbb
*/
// 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 = String( (d.getMonth() + 1) / 100 ).substr(-2);
var date:String = String( d.getDate() / 100 ).substr(-2);
var full:String = String(d.fullYear) + month + date;
(addChild( new TextField() ) as TextField).appendText( full );
}
//private function o2t( str:String ):String
//{
// return str.length < 2 ? "0" + str : str;
//}
}
}