I am sending several properties as json, the datetime property is transferred some kind of broken, all others are fine.
How I receive a datetim property in javascript:
Created: "/Date(1441198490467+0200)/"
This would be the desired date: 02.09.2015 14:54:50
How can I fix this?
C#:
Webservice:
[System.ServiceModel.OperationContract]
[System.ServiceModel.Web.WebGet(UriTemplate = "PeekCustomer", ResponseFormat = WebMessageFormat.Json)]
System.Collections.Generic.List<BusinessObjects.Customer> PeekCustomers();
The date property:
public DateTime Created {
get;
set;
}
Accessing the data:
while (reader.Read()) {
result.Add(new BusinessObjects.Customer {
ID = reader.GetGuid(0),
Name = reader.GetString(1),
Created = reader.GetDateTime(2)
});
}
Javascript(Angular):
app.config(function(RestangularProvider){
RestangularProvider.setBaseUrl('http://localhost:31896/BusinessService.svc/');
RestangularProvider.setDefaultRequestParams('jsonp', { callback: 'JSON_CALLBACK' });
RestangularProvider.setFullResponse(true);
});
The service:
Restangular.all('').customGET('PeekCustomer').then(function (result){
data.customers = result;
})