Java获取当前时间到格林威治时间1970年01月01日00时00分00秒的秒数

前言

最近一个需求需要对接某全球性组织,接口文档对某栏位的描述如下:

which is the number of seconds from 1970-01-01T00:00:00Z UTC

从格林威治时间1970年01月01日00时00分00秒到当前时间的秒数

实现代码

JSONObject header = new JSONObject()
                    .fluentPut("TIMESTAMP",System.currentTimeMillis()/1000 + "");

PS:
System.currentTimeMillis()返回的是long型,接口中对面一定需要为String型,所以加了个 + “” 处理

发布了42 篇原创文章 · 获赞 0 · 访问量 1423

猜你喜欢

转载自blog.csdn.net/tcctcszhanghao/article/details/103688655