forked from: forked from: forked from: 1桁の月や日を0Xの形に
/**
* Copyright kacchan6 ( http://wonderfl.net/user/kacchan6 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/ps3Z
*/
// forked from Nicolas's forked from: forked from: 1桁の月や日を0Xの形に
// forked from Nicolas's forked from: 1桁の月や日を0Xの形に
// 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;
var t:TextField = (addChild( new TextField() ) as TextField)
t.appendText( full );
//4月5日でテスト
d = new Date(2011, 3, 5);
// 単に8桁なら「(年*10000) + (月 * 100) + 日」でもおk
full = String(d.fullYear * 10000 + (d.month + 1) * 100 + d.date);
t.appendText("\n" + full)
}
}
}