test_time.py 620 B

12345678910111213141516
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. # File : test_time.py
  4. # Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
  5. # Date : 2022/12/29
  6. import datetime
  7. from datetime import timedelta
  8. if __name__ == '__main__':
  9. # a = datetime.datetime.now().now().replace(hour=0, minute=1)).strftime('%Y-%m-%d %H:%M:%S')
  10. # print(a)
  11. print(datetime)
  12. print(datetime.datetime.now())
  13. print(datetime.datetime.now().replace(hour=0, minute=1).strftime('%Y-%m-%d %H:%M:%S'))
  14. print((datetime.datetime.now().replace(hour=0, minute=0, second=0)+ timedelta(days=1)).strftime('%Y-%m-%d %H:%M:%S'))