You must Sign In to post a response.
  • Category: JQuery

    How to convert json date to normal date

    Hiii All
    i got a requirement that is converting json date format to normal date
    json date like 2010-12-27T10-57-06Z
    converted date sholud be like dd-mm-yy hr:min am or pm format
    please suggest me how to achieve this
  • #758135
    Hi nagendra.

    Go through this links.

    mvcworld.blogspot.in/2013/06/convert-json-date-to-javascript-date.html?m=1

    www.codeproject.com/Questions/782784/How-Can-I-Convert-Json-Datetime-To-Normal-Date-Tim

    regards

    Sridhar.
    DNS Member.

    Sridhar Thota.
    Editor: DNS Forum.

  • #758136
    Use this js function to convert json date to normal format
    function ConvertJsonDateString(jsonDate) {
    var shortDate = null;
    if (jsonDate) {
    var regex = /-?\d+/;
    var matches = regex.exec(jsonDate);
    var dt = new Date(parseInt(matches[0]));
    var month = dt.getMonth() + 1;
    var monthString = month > 9 ? month : '0' + month;
    var day = dt.getDate();
    var dayString = day > 9 ? day : '0' + day;
    var year = dt.getFullYear();
    shortDate = monthString + '-' + dayString + '-' + year;
    }
    return shortDate;
    };

    Regards & thanks
    Arvind kumar
    Visit--blog.akumars.esoftera.in


  • Sign In to post your comments