Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
2534 Visualizações

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
Cancelar
Autor Melhor resposta

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
Cancelar
Melhor resposta

Hi,

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

Thanks

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
2
fev. 21
15817
1
out. 20
2817
2
ago. 19
3187
0
set. 16
3823
1
abr. 16
6266