date formatting with/without Moment.js

后端 未结 4 638
旧巷少年郎
旧巷少年郎 2020-12-11 04:17

I am trying to reformat a date that I am getting from an API. In the object I have:

created_at: \"2013-06-13T16:29:55.245Z\"

I would like

4条回答
  •  [愿得一人]
    2020-12-11 04:57

    No need to modify the original string, you can just use it like this:

    alert(moment("2013-06-13T16:29:55.245Z").format("M/DD/YYYY"));
    

    Works well: http://jsfiddle.net/K5ub8/2/

提交回复
热议问题