JavaScript format Date that comes from JSON CSharp Handler
Format Date that comes from JSON (C# Handler).... I have bothered a lot on this that's why I have paste it here :)
//format date
function FormatDate(date) {
var returnValue = '';
try {
if (date != null && date != 'undefined') {
//Format the date
var jsonDate = date;
//Remove all non-numeric (except the plus)
jsonDate = jsonDate.replace(/[^0-9 +]/g, '');
//Create date
var date = new Date(parseInt(jsonDate));
var day = date.getDate();
var month = date.getMonth() + 1;
var year = date.getFullYear();
if (year != 3939) {
returnValue = (day + "/" + month + " " + year);
}
}
} catch (ex) {
throw ex;
}
return returnValue;
}
//format string
function LimitString(text, limit) {
if (text != null && text != 'undefined')
return text.substring(0, parseInt(limit)) + '...';
return text;
}
Comments