How to convert utc datetime to local?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- 회계
- 재고 관리
- PoS
- Project
- MRP
신고된 질문입니다
1
회신
21695
화면
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
|
27271 | ||
|
2
6월 22
|
5804 | ||
|
2
9월 21
|
4770 | ||
|
1
11월 20
|
8074 | ||
|
2
3월 19
|
6198 |
See this: https://www.youtube.com/watch?v=ZxrDGTEU7B8