跳至內容
選單
此問題已被標幟
2 回覆
2785 瀏覽次數

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
16051
1
10月 20
3042
2
8月 19
3429
0
9月 16
4012
1
4月 16
6458