在下面的 json 响应中,createdDate 和 UpdatedDate 的日期格式是什么?我不知道如何反向工作来查找 api 使用的日期格式。我在文档中找不到此内容。
{
"size": 1,
"limit": 25,
"isLastPage": true,
"values": [
{
"id": 101,
"version": 1,
"title": "Talking Nerdy",
"description": "It’s a kludge, but put the tuple from the database in the cache.",
"state": "OPEN",
"open": true,
"closed": false,
"createdDate": 1359075920,
"updatedDate": 1359085920,
"fromRef": {
"id": "refs/heads/feature-ABC-123",
"repository": {
"slug": "my-repo",
"name": null,
"project": {
"key": "PRJ"
}
}
},
"toRef": {
"id": "refs/heads/master",
"repository": {
"slug": "my-repo",
"name": null,
"project": {
"key": "PRJ"
}
}
},
"locked": false,
"author": {
"user": {
"name": "tom",
"emailAddress": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="34405b5974514c55594458511a575b59" rel="noreferrer noopener nofollow">[email protected]</a>",
"id": 115026,
"displayName": "Tom",
"active": true,
"slug": "tom",
"type": "NORMAL"
},
"role": "AUTHOR",
"approved": true
},
"reviewers": [
{
"user": {
"name": "jcitizen",
"emailAddress": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2248434c4762475a434f524e470c414d4f" rel="noreferrer noopener nofollow">[email protected]</a>",
"id": 101,
"displayName": "Jane Citizen",
"active": true,
"slug": "jcitizen",
"type": "NORMAL"
},
"role": "REVIEWER",
"approved": true
}
],
"participants": [
{
"user": {
"name": "dick",
"emailAddress": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="600409030b200518010d100c054e030f0d" rel="noreferrer noopener nofollow">[email protected]</a>",
"id": 3083181,
"displayName": "Dick",
"active": true,
"slug": "dick",
"type": "NORMAL"
},
"role": "PARTICIPANT",
"approved": false
},
{
"user": {
"name": "harry",
"emailAddress": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5d353c2f2f241d38253c302d3138733e3230" rel="noreferrer noopener nofollow">[email protected]</a>",
"id": 99049120,
"displayName": "Harry",
"active": true,
"slug": "harry",
"type": "NORMAL"
},
"role": "PARTICIPANT",
"approved": true
}
],
"link": {
"url": "http://link/to/pullrequest",
"rel": "self"
},
"links": {
"self": [
{
"href": "http://link/to/pullrequest"
}
]
}
}
],
"start": 0
}
最佳答案
请注意,在我的例子中,它是一个 UNIX 时间戳,但我必须删除三个尾随零。例如。数据如下所示:
"createdDate":1555621993000
如果解释为 UNIX 时间戳,则为 09/12/51265 @ 4:16am (UTC)。
通过删除三个尾随零,我得到 1555621993,这是正确的时间 04/18/2019 @ 9:13pm (UTC)
您的里程可能会有所不同,但这对我来说是一个重要的发现:)
关于bitbucket-server - stash api 的日期格式是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36614688/