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
الرد
21679
أدوات العرض
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
يوليو 23
|
27266 | ||
|
2
يونيو 22
|
5802 | ||
|
2
سبتمبر 21
|
4759 | ||
|
1
نوفمبر 20
|
8067 | ||
|
2
مارس 19
|
6195 |
See this: https://www.youtube.com/watch?v=ZxrDGTEU7B8