Convert json date to date format in jQuery

7 Mar

In this post we will learn how to convert  Json date to date format in jQuery.

Example: /Date(1334514600000)/     ——————————–> dd/mm/yyy

Implementation

 

var dateString = "\/Date(1334514600000)\/".substr(6);
var currentTime = new Date(parseInt(dateString ));
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var year = currentTime.getFullYear();
var date = day + "/" + month + "/" + year;
alert(date);
 
You can test this in JsFiddle http://jsfiddle.net/

Place the above code in JsFiddle and type Run

7 thoughts on “Convert json date to date format in jQuery

Leave a Reply

Your email address will not be published. Required fields are marked *