在使用django框架时,需要在settings中将时区设置成上海

TIME_ZONE = 'Asia/Shanghai'
USE_TZ = True

 

 

手动方式:

from django.utils import timezone
#
print(timezone.localtime(i.create_time).strftime("%Y-%m-%d %H:%M:%S"))

 

相关文章:

  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-06-10
  • 2021-10-19
  • 2022-12-23
  • 2021-08-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2021-05-21
相关资源
相似解决方案