1桁の月や日を0Xの形に
もっとスマートに出来ないでしょうか?
♥0 |
Line 17 |
Modified 2011-02-11 09:51:15 |
MIT License
archived:2017-03-10 16:22:56
ActionScript3 source code
/**
* Copyright zahir ( http://wonderfl.net/user/zahir )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/8VPv
*/
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 str.length < 2 ? "0" + str : str;
}
}
}