Monday, May 27, 2013

MomentJS: convert from javasript date object to formated String

var myDateObject = new Date();
var myMomentJSFormat = "DD/MM/YYYY hh:mm";
        var myMomentObject = moment(myDateObject);
        // formated using moment.js
        var myMomentObjectFormated = myMomentObject.format(myMomentJSFormat);

Resources:
http://momentjs.com/docs/#/displaying/format/


No comments: