■ つかいかた(基礎編) ダウンロードしたmoment.jsをscriptタグで読み込ませたら準備完了です。 あとは下記のような実装で使用できます。 // momentオブジェクトを初期化して・・・ var m = moment(); // formatで出力! var output = m.format("YYYY年MM月DD日 HH:mm:ss dddd"); console.log(output); // => 2013年05月15日 12:34:56 Wednesday // 現在時刻 moment(); // ミリ秒で指定 moment(1368543600000); // タイムスタンプ(秒)で指定 moment.unix(1368543600); // Date.parseで解析可能な文字列を指定 moment("May 15, 2013"); // Dateオブジェクトか
![JavaScriptで日付を扱うならこれ!「moment.js」](https://cdn-ak-scissors.b.st-hatena.com/image/square/fb82e018058b1db46e904d436ec4d1ed4e27d2c4/height=288;version=1;width=512/https%3A%2F%2Fblog.asial.co.jp%2Fwp-content%2Fuploads%2F2022%2F07%2Fdefault.png)