We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import datetime print(datetime.datetime.now())
2022-12-28 13:17:17.400825
date_time = datetime.datetime.now.strftime("%m/%d/%Y, %H:%M:%S")
pytz
import pytz import datetime tz = pytz.timezone('Asia/Shanghai') datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
tz_utc_8 = datetime.timezone(datetime.timedelta(hours=8)) datetime.datetime.now(tz_utc_8)
datetime.datetime.now(tz_utc_8).isoformat(' ')
'2020-03-12 13:53:24.699528+08:00'
The text was updated successfully, but these errors were encountered:
No branches or pull requests
datetime
获取时间
格式化输出
获取不同时区的时间
通过
pytz
设置时区通过加减时间计算
Reference
The text was updated successfully, but these errors were encountered: