7 Mar

Convert json date to date format in jQuery

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 *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>