Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
2750 Vues

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
Ignorer
Auteur Meilleure réponse

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
Ignorer
Meilleure réponse

Hi,

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

Thanks

Avatar
Ignorer
Publications associées Réponses Vues Activité
2
févr. 21
16004
1
oct. 20
3012
2
août 19
3368
0
sept. 16
3966
1
avr. 16
6397