官术网_书友最值得收藏!

Dates

When returning a date, you should always use the DateLiteral format and preferably the Iso8601Literal. If you do need to send back a date in a format other than Iso8601Literal, then you can use a StructuredDateLiteral format, which allows you to specify the kind as part of the returned entity.

The informal Iso8601Literal format is the simplest method to use and should be understandable by almost any client consuming your API:

{"date": "2016-07-14T16:00Z"} 

The more formal StucturedDateLiteral does not return a string, but an entity that contains two properties, kind and value:

{"date": {"kind": "U", "value": 1471186826}} 

The permissible kinds are:

  • C: CLR; number of milliseconds since midnight January 1 00
  • E: ECMAScript; number of milliseconds since midnight, January 1, 1970
  • I: ISO 8601; a string limited to the ECMAScript subset
  • O: OLE Date; integral part is the number of days since midnight, December 31, 1899, and fractional part is the time within the day (0.5 = midday)
  • T: Ticks; number of ticks (100-nanosecond intervals) since midnight January 1, 1601
  • U: UNIX; number of seconds since midnight, January 1, 1970
  • W: Windows; number of milliseconds since midnight January 1, 1601
  • X: Excel; as for O, but the year 1900 is incorrectly treated as a leap year, and day 0 is "January 0 (zero)"
主站蜘蛛池模板: 阿克| 长武县| 武清区| 赫章县| 通山县| 邢台市| 丹棱县| 襄汾县| 东莞市| 甘南县| 乳山市| 榆中县| 策勒县| 忻城县| 涿州市| 白玉县| 台北县| 洛宁县| 桑日县| 鹤岗市| 秀山| 秦安县| 九龙城区| 江西省| 三亚市| 潼关县| 通城县| 武邑县| 溧阳市| 土默特右旗| 双流县| 罗定市| 广昌县| 潜山县| 云和县| 天祝| 陆川县| 张家口市| 台中市| 泰宁县| 吴旗县|