007grafana监控时间戳转换

https://d.jyall.me/dashboard-solo/db/soloview?panelId=1&var-metrics=stats.gauges.zookeeper.monitor.xg_arch_soa_zk_5.synced_followers&from=1539153284120&to=1539295502327

(1)后边的为毫秒的时间戳转换(互转在线工具如下): https://tool.lu/timestamp/

007grafana监控时间戳转换

(2)python来实现转换:

#!/usr/bin/env python # -*- coding:utf-8 -*- import time def timeStamp(timeNum): \'\'\' 13位时间戳(毫秒级)转成正常格式的时间 :param timeNum: :return: \'\'\' timeStamp = float(timeNum/1000) timeArray = time.localtime(timeStamp) otherStyleTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray) return otherStyleTime def timeToStamp(date): millis = int(round(time.time() * 1000)) return millis def main(): print timeStamp(1539301262215) #2018-10-12 07:41:02 print timeToStamp("") #1539316977202(十三位now的时间戳) if __name__ == \'__main__\': main()

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzjspw.html