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.

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