İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
3229 Görünümler

Hello,


I try to get the time in the user's time zone. Here is my code, generating an error:


user_tz = self.env.user.tz
MyDate = record.x_studio_approved_date_time_exit.user_tz
record['x_studio_time_exit'] = MyDate.strftime("%H:%M")


But it gives me an error... since the ".user_tz" is not supported.


Can you tell me how to solve this?


Thank you!




Avatar
Vazgeç
Üretici En İyi Yanıt

no, error is

ValueError: : "name 'env' is not defined" while evaluating.


With my code the error is:

ValueError: : "'datetime.datetime' object has no attribute 'user_tz'" while evaluating



Avatar
Vazgeç
En İyi Yanıt

Hi,

Did you tried with env.user.tz without self ?

Thanks

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Şub 21
16375
1
Eki 20
3435
2
Ağu 19
3782
0
Eyl 16
4382
1
Nis 16
6720