bitbucket-server - stash api 的日期格式是什么?

标签 bitbucket-server

在下面的 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/

相关文章:

google-cloud-platform - 云构建发布/订阅主题似乎未列出或无法访问

git - Jenkins CI 构建后操作 - 如何推送到 Stash

java - 当 pull 请求 merge 到 bitbucket 时自动更新 npm 版本

docker - 如何在分离模式下将Bitbucket服务器作为容器启动?

java - Bitbucket Api 以 ssh 访问 key 作为 header ,用于获取 java 中拉取请求的总数

git - 从 Bitbucket 导入到 Stash 并包含历史记录?

rest - 如何通过 Bitbucket REST API 获取连接用户的身份?

jenkins - Bitbucket webhook 触发 Jenkins 作业

plugins - 如何呈现 Atlassian 插件的配置屏幕?

bitbucket-server - 如何从 Atlassian Stash Pre Receive Repository Hook 中的 refChanges 获取提交列表