我想创建JavaScript倒计时,但我必须使用原子钟(非本地PC时间)。我找到了http://worldclockapi.com/api/json/est/now,它为您提供了一个JSON。
有一个属性currentFileTime (时间戳),但没有UNIX时间戳。
如何将此时间戳转换为UNIX时间戳,获取Date对象并检查日期、小时、分钟和秒?
谢谢
发布于 2019-07-15 11:45:06
只需选择一个时区并称之为:
调用http://worldtimeapi.org/api/timezone/Europe/London.json
您将得到一个具有unix时间的json对象,如下所示:
let result = {"week_number":29,"utc_offset":"+01:00","utc_datetime":"2019-07-15T11:44:07.720355+00:00","unixtime":1563191047,"timezone":"Europe/London","raw_offset":0,"dst_until":"2019-10-27T01:00:00+00:00","dst_offset":3600,"dst_from":"2019-03-31T01:00:00+00:00","dst":true,"day_of_year":196,"day_of_week":1,"datetime":"2019-07-15T12:44:07.720355+01:00","client_ip":"194.153.217.248","abbreviation":"BST"}
// result["unixtime"] => 1563191047https://stackoverflow.com/questions/57038800
复制相似问题