MomentJS - 作为对象

此方法以对象形式提供输出,包含年、月、日、时、分、秒、毫秒。

语法

moment().toObject();

示例

var a = moment().toObject();
var objstr = a.years + " " + a.months + " " + a.date + " " + a.hours + " " + a.minutes + " " + a.seconds;

输出

As Object

momentjs_formatting_date_and_time.html