Monday, November 19, 2012

How can I format a json date in dd/mm/yy format in javascript


Json return date as timestamp to convert that date to our normal date format we first convert timestamp to Date . then we get day, month, year from Date and format it as dd/mm/yyyy or mm/dd/yyyy or yyyy/mm/dd and other format.


function EditCheque(id) {
        $.post("/Partner/ChqEdit", { id: id }, function (data) {


var date = new Date(parseInt(data.ChqDate.substr(6)));
$("#ChqDate").val( date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear());
});

No comments:

SQL Optimization

  SQL Optimization  1. Add where on your query  2. If you remove some data after the data return then remove the remove condition in the sel...