I am consuming an REST service that allows me to query a table in a database. There is a date field in that table, but the service is returning the date in a开发者_如何学编程 strange format, and I'm unsure how to parse it.
I know for a fact that a certain record's date is 2010/07/16 00:00:00 UTC
, and the string that I get for the date is 1279238400000
. How is this date being encoded? How to I get from that large number to July 7, 2010?
I think what you're having is milliseconds since 1970-01-01.
Looks to be a Javascript-style timestamp: milliseconds since Jan 1/1970:
mysql> select from_unixtime(1279238400000 / 1000);
+-------------------------------------+
| from_unixtime(1279238400000 / 1000) |
+-------------------------------------+
| 2010-07-15 18:00:00 |
+-------------------------------------+
1 row in set (0.05 sec)
Giving 6pm, July 15th, 2010.
精彩评论