トップ 差分 一覧 ソース 検索 ヘルプ PDF RSS ログイン

日付時間の取得_Flash

日付時間の取得

ActionScriptで日付けと時間を取得するには、「Date」クラスを作成して、これのメソッドより「年・月・日」「時間・分・秒」を取得します。

t = new Date();
year  = t.getYear() + 1900;    //年の取得(西暦の場合は+1900する)
month = t.getMonth() + 1;      //月の取得(0〜11が返るので+1する)
day   = t.getDate();           //日の取得(1〜31)

h = t.getHours();    //時間の取得(0〜23)
m = t.getMinutes();  //分の取得(0〜59)
s = t.getSeconds();  //秒の取得(0〜59)

Future's Laboratory 技術格納庫 2004-2013 Yutaka Yoshisaka.