Javascript年月日取得

YYYYMMDD形式

function test(){
    var today = new Date();
    var aaa = String(today.getFullYear()) + (’00′ + (parseInt(today.getMonth()) + parseInt(1))).slice(-2) + (’00′ + (today.getDate(1))).slice(-2);
    alert(aaa);
}

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>