Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
154
rated 0 times [  156] [ 2]  / answers: 1 / hits: 17679  / 10 Years ago, wed, november 12, 2014, 12:00:00

I'm new to swagger and writing my first spec. I've found following swagger date types*:



------------------------------------------------
| Common name | Swagger spec 1.2 |
------------------------------------------------
| string | string |
------------------------------------------------
| date | string, date |
------------------------------------------------
| dateTime | string, date-time |
------------------------------------------------


Now my timestamp looks like 2014-12-09T13:06:08.260+0000 is this even a Date? It doens't look like the date javascript new Date(); returns. I also haven't found a date type in the json specification.



Which type and format should i take, will it be better to take string instead of a date??



*: note this table is the short version from the swager wiki


More From » json

 Answers
2

2014-12-09T13:06:08.260+0000 is a variation of ISO8601 date and time standard. JavaScript Date function can easily parse this format and Date has toISOString() method to produce strings in this format. The only thing is that letter Z is usually used to denote GMT/UTC time zone instead of +0000. But Date can parse it like that too.


[#68832] Sunday, November 9, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tyasiaalmap

Total Points: 294
Total Questions: 107
Total Answers: 108

Location: Libya
Member since Mon, Dec 7, 2020
4 Years ago
;