Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
3199 Vizualizări

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!




Imagine profil
Abandonează
Autor Cel mai bun răspuns

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



Imagine profil
Abandonează
Cel mai bun răspuns

Hi,

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

Thanks

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
feb. 21
16359
1
oct. 20
3390
2
aug. 19
3757
0
sept. 16
4335
1
apr. 16
6707