I'm trying to convert a JSON date to a dd/mm/yyyy format, which I'm managing to do semi-successfully.
The problem I'm encountering is that the date from the record in the DB is for example, 2009-06-29 which is returning the usual JSON /Date(1246230000000)/
, however, when I try and turn it into the previously mention dd/mm/yyyy format, it's coming through as today's date.
The code I'm using to try and do this is:
$('input#EmployeeName').result(function(event, data, formatted) {
$('#StartDate').html(formatJSONDate(Date(!data ? '' : data.StartDate)));
});
function formatJSONDate(jsonDate) {
var newDate = dateFormat(jsonDate, "dd/mm/yyyy");
return newDate;
}
I'm using JavaScript Date Format to try and run the function.
Any help is greatly appreciated.