相关文章推荐
冷静的豌豆  ·  mysql ...·  3 天前    · 
开朗的大白菜  ·  python / shell / ...·  3 天前    · 
求醉的油条  ·  openseadragon-fabricjs ...·  5 月前    · 
兴奋的熊猫  ·  使用 PowerShell+WinRM ...·  7 月前    · 
谈吐大方的木瓜  ·  jenkins - failed to ...·  1 年前    · 
hutc = datetime.datetime.utcnow() # utc - 12 时间 hutc12 = datetime.datetime.utcnow()-datetime.timedelta(hours=12) # utc 30 天 hutcday30 = datetime.timedelta(days=30) # utc - 12h - 30d 格式化位时 hutc12h30d = (hutc12-hutcday30).strftime("%Y-%m-%d %H:00:00") # 10位 时间戳 hutc12h30dtuple10w = int(time.mktime((time.strptime(hutc12h30d, "%Y-%m-%d %H:%M:%S")))) # 13位时间戳 hutc12h30dtuple13w = int(time.mktime((time.strptime(hutc12h30d, "%Y-%m-%d %H:%M:%S"))) * 1000) # 当前时间 - 15d hlocal15 = datetime.datetime.now()-datetime.timedelta(days=15) # 当前时间 - 15d 转 毫秒级时间戳 hlocal15inttuple = (time.mktime(hlocal15.timetuple()) * 1000 + hlocal15.microsecond / 1000)

shell

# 获取当前时间 / 毫秒精度
current=`date "+%Y-%m-%d %H:%M:%S"`
# 获取当前时间 - 30d / 毫秒精度
current15d=`date -d -30days "+%Y-%m-%d %H:%M:%S"`
# 转换毫秒时间戳
timeStamp=`date -d "$current" +%s`
currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000))
echo $currentTimeStamp

mysql

mysql -u root -p'password' -e "SELECT REPLACE(unix_timestamp(current_timestamp(3)),'.','');"