Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
2538 Tampilan

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
Buang
Penulis Jawaban Terbai

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
Buang
Jawaban Terbai

Hi,

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

Thanks

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Feb 21
15820
1
Okt 20
2820
2
Agu 19
3188
0
Sep 16
3829
1
Apr 16
6270