I've seen other examples but I am looking for this specific format if possible?.
            Asked
            
        
        
            Active
            
        
            Viewed 4.1k times
        
    2
            
            
        - 
                    possible duplicate of [How to format JSON Date?](http://stackoverflow.com/questions/206384/how-to-format-json-date) – David Hoerster Mar 09 '11 at 16:37
- 
                    these examples do not have dd/mm/yyyy format, well the one they do have doesnt work – Calibre2010 Mar 09 '11 at 16:45
4 Answers
7
            
            
        Here is a quick format from JSON date format to required date format using jQuery:
For a JSON date string like:
/Date(1339439400000)/
try:
var newFormattedDate = $.datepicker.formatDate('mm/dd/yy', new Date(Date(your_JSON_date_string)));
and it will result in date like this: 09/14/2012
6
            
            
            function formatJsonDate(jsonDate) {
        return (new Date(parseInt(jsonDate.substr(6)))).format("dd/mm/yyyy");
    };    
    var testJsonDate = formatJsonDate('/Date(1224043200000)/');
    alert(testJsonDate);
 
    
    
        Thulasiram
        
- 8,432
- 8
- 46
- 54
2
            
            
        There is no "json date format". json only returns strings.
Date javascript object can parse a variety of formats. See the documentation.
You can do:
var myDate = new Date(myDateAsString);
 
    
    
        Vincent Mimoun-Prat
        
- 28,208
- 16
- 81
- 124
1
            
            
        There are a few suggestions in the answers to this post -- How do I format a Microsoft JSON date?
If those examples aren't working, you can just format it manually. Here's a quick fiddle that demonstrates it -- http://jsfiddle.net/dhoerster/KqyDv/
$(document).ready(function() {
    //set up my JSON-formatted string...
    var myDate = new Date(2011,2,9);
    var myObj = { "theDate" : myDate };
    var myDateJson = JSON.stringify(myObj);
    //parse the JSON-formatted string to an object
    var myNewObj = JSON.parse(myDateJson);
    //get the date, create a new Date object, and manually format the date string
    var myNewDate = new Date(myNewObj.theDate);
    alert(myNewDate.getDate() + "/" + (myNewDate.getMonth()+1) + "/" + myNewDate.getFullYear());
});
 
    
    
        Community
        
- 1
- 1
 
    
    
        David Hoerster
        
- 28,421
- 8
- 67
- 102
 
     
    