コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
3181 ビュー

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

アバター
破棄
関連投稿 返信 ビュー 活動
2
2月 21
16355
1
10月 20
3370
2
8月 19
3754
0
9月 16
4314
1
4月 16
6703