Momentjs-get

提供:Dev Guides
移動先:案内検索

MomentJS-取得

このメソッドは、年、月、日付、時間、分、秒、ミリ秒を取得します。

構文

moment().get('year');
moment().get('month');
moment().get('date');
moment().get('hour');
moment().get('minute');
moment().get('second');
moment().get('millisecond');

var m = moment().get('year');
var d = moment().get('month');
var a = moment().get('date');
var k = moment().get('hour');
var o = moment().get('minute');
var s = moment().get('second');
var ms = moment().get('millisecond');

出力

取得

*get* メソッドの場合、取得される単位は次の表に示されています。 単位は大文字と小文字を区別しないか、複数にすることができます。 以下に示す表を確認してください-
year or years or y month or months or M date or dates or D hour or hours or H Minute or minutes or m second or seconds or s millisecond or milliseconds or ms