How to convert utc datetime to local?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- 客户关系管理
- e-Commerce
- 会计
- 库存
- PoS
- Project
- MRP
此问题已终结
1
回复
21215
查看
How to convert utc datetime to local?
Hello Giezel Esteves,
You have to use ORM methods to convert the datetime data to Different TZ(Time Zone).
import pytz
user_tz = self.env.user.tz or pytz.utc
local = pytz.timezone(user_tz)
display_date_result = datetime.strftime(pytz.utc.localize(datetime.strptime(your_date_or_datetime_info,
DEFAULT_SERVER_DATETIME_FORMAT)).astimezone(local),"%d/%m/%Y %H:%M%S")
相关帖文 | 回复 | 查看 | 活动 | |
---|---|---|---|---|
|
3
7月 23
|
26019 | ||
|
2
6月 22
|
5257 | ||
|
2
9月 21
|
4124 | ||
|
1
11月 20
|
7366 | ||
|
2
3月 19
|
5542 |
See this: https://www.youtube.com/watch?v=ZxrDGTEU7B8