空港防疫算法交互
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
412B

  1. import time
  2. from datetime import datetime
  3. YY_MM_DD_HH_MM_SS = "%Y-%m-%d %H:%M:%S"
  4. YMDHMSF = "%Y%m%d%H%M%S%f"
  5. def generate_timestamp():
  6. """根据当前时间获取时间戳,返回整数"""
  7. return int(time.time())
  8. def now_date_to_str(fmt=None):
  9. if fmt is None:
  10. fmt = YY_MM_DD_HH_MM_SS
  11. return datetime.now().strftime(fmt)
  12. if __name__=="__main__":
  13. print(now_date_to_str(YMDHMSF))