Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
62
rated 0 times [  67] [ 5]  / answers: 1 / hits: 16723  / 11 Years ago, thu, june 13, 2013, 12:00:00

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 to display the date as 6/13/2013. Someone suggested I use moment.js. It has tons of documentation but i'm a bit confused on how to use it. can someone please help or suggest an easier way to do this?


More From » date

 Answers
33

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/


[#77635] Wednesday, June 12, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gerardob

Total Points: 571
Total Questions: 115
Total Answers: 96

Location: Cyprus
Member since Mon, Oct 24, 2022
2 Years ago
;