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
- Contabilitate
- Inventar
- PoS
- Project
- MRP
Această întrebare a fost marcată
1
Răspunde
21680
Vizualizări
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")
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Înscrie-teRelated Posts | Răspunsuri | Vizualizări | Activitate | |
---|---|---|---|---|
|
3
iul. 23
|
27268 | ||
|
2
iun. 22
|
5802 | ||
|
2
sept. 21
|
4760 | ||
|
1
nov. 20
|
8069 | ||
|
2
mar. 19
|
6195 |
See this: https://www.youtube.com/watch?v=ZxrDGTEU7B8