2025-09-10:仓库迁移
This commit is contained in:
14
3.数字日期和时间/16.处理涉及时区的日期问题.py
Normal file
14
3.数字日期和时间/16.处理涉及时区的日期问题.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from datetime import datetime
|
||||
from pytz import timezone
|
||||
|
||||
if __name__ == "__main__":
|
||||
d = datetime(2012, 12, 21, 9, 30, 0)
|
||||
print(d)
|
||||
|
||||
central = timezone('US/Central')
|
||||
loc_d = central.localize(d)
|
||||
print(loc_d)
|
||||
|
||||
bang_d = loc_d.astimezone(timezone("Asia/Kolkata"))
|
||||
print(bang_d)
|
||||
|
Reference in New Issue
Block a user