I have following values for my Subscription StartDate and EndDate in my database.
StartDate = 2017-05-12 16:13:39.007
EndDate = 2017-10-12 10:23:28.100
My API Controller.
public HttpResponseMessage GetSubscription()
{
var license = _licenseService.GetLicense(curUser.Id);
response = Util.Create(HttpStatusCode.OK, message: "Subscription Found", data: license);
}
This is how my response looks in postman.
{
"statusCode": 200,
"data": {
"licenses": [
{
"licenseId": 597,
"startDate": "2017-05-12T16:13:39.007Z",
"endDate": "2017-10-12T10:23:28.1Z" // notice 100 ms is trimmed to 1
}
]}}
If you notice in the above response the number of characters in the date(s) are different.Because 00 part of the ms is trimmed
But this creates problem for my mobile clients because they format the date accordingly.
How do I make sure such trimming doesn't happen for any date whether the date has value like
2017-05-12 16:13:39.007 or 2017-05-12 16:13:39.000
Thanks.