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()

  

上一篇:为什么我不推荐你使用vue-cli创建脚手架?


下一篇:2018-2019-1 20189201 《LInux内核原理与分析》第六周作业