import time

 

一、时间戳转换成struct_time(tuple):

  gmtime:把时间戳转换成UTC时区struct_time

  Python time module总结

  localtime:把时间戳转换成当前所在地时区struct_time

  Python time module总结

二、struct_time转换成时间戳:

  mktime:把strut_time转换成时间戳

  Python time module总结

三、struct_time转换成格式化字符串时间:

  strftime:

  Python time module总结

四、格式化的字符串时间转换成struct_time:

  strptime:

  Python time module总结

五、ctime

  Python time module总结

  c_time = datetime.datetime.now()

  c_time.replace(minute=3, hour=2) 时间替换

六、asctime

  Python time module总结

相关文章: