Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
3201 Visualizzazioni

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
Abbandona
Autore Risposta migliore

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
Abbandona
Risposta migliore

Hi,

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

Thanks

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
feb 21
16360
1
ott 20
3392
2
ago 19
3758
0
set 16
4342
1
apr 16
6710