admin管理员组文章数量:1245084
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
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
Share Improve this question asked Nov 12, 2014 at 10:09 MemLeakMemLeak 4,6404 gold badges48 silver badges85 bronze badges1 Answer
Reset to default 112014-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.
本文标签: javascriptSwagger and DateStack Overflow
版权声明:本文标题:javascript - Swagger and Date - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740245817a2248218.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论