Recommended date format for REST GET API

前端 未结 5 1299
一向
一向 2020-12-12 16:13

What\'s the recommended timestamp format for a REST GET API like this:

http://api.example.com/start_date/{timestamp}

I think the actual dat

5条回答
  •  天涯浪人
    2020-12-12 16:26

    RFC6690 - Constrained RESTful Environments (CoRE) Link Format Does not explicitly state what Date format should be however in section 2. Link Format it points to RFC 3986. This implies that recommendation for date type in RFC 3986 should be used.

    Basically RFC 3339 Date and Time on the Internet is the document to look at that says:

    date and time format for use in Internet protocols that is a profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.

    what this boils down to : YYYY-MM-ddTHH:mm:ss.ss±hh:mm

    (e.g 1937-01-01T12:00:27.87+00:20)

    Is the safest bet.

提交回复
热议问题