Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
3200 Представления

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!




Аватар
Отменить
Автор Лучший ответ

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



Аватар
Отменить
Лучший ответ

Hi,

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

Thanks

Аватар
Отменить
Related Posts Ответы Просмотры Активность
2
февр. 21
16359
1
окт. 20
3392
2
авг. 19
3758
0
сент. 16
4339
1
апр. 16
6710