Applications, one server and multiple clients, POST
and GET
to the server exchange JSON
objects.
One of the variables that goes along with JSON
is datahora atual
, I see different Strngs
to represent dates, such as:
"\"\/Date(1335205592410)\/\"" .NET JavaScriptSerializer
"\"\/Date(1335205592410-0500)\/\"" .NET DataContractJsonSerializer
"2012-04-23T18:25:43.511Z" JavaScript built-in JSON object
"2012-04-21T18:25:43-05:00" ISO 8601
Or even the error returned from the server, brings some examples of parsers to these dates:
(error: Failed to parse Date value 'Jun 7, 2017 08:44:51 AM': Can not parse date "Jun 7, 2017 11:44:51 AM": not compatible with any of standard forms ("yyyy-MM-dd'T'HH:mm:ss.SSSZ", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "EEE, dd MMM yyyy HH:mm:ss zzz", "yyyy-MM-dd"))
I searched, and there is little talk about representing that date in a long, sending and just creating a Date
on the server or even saving as long in the database, so at least it seems simpler and would avoid these problems reading the date.
I know it's possible to do this, but I was curious about the few implementations, or almost none I found. So, using long
, would it be wrong, or would it be some kind of "bad practice"?