콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
3 답글
67745 화면

how can I get the current date with the correct timezone of the user printing the report?

I am using this, but this brings the current UTC time.
<span t-esc="time.strftime('%Y-%m-%d %H:%M:%S')"/>

아바타
취소
베스트 답변
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"/>   
아바타
취소

This should be the correct answer

This is the correct answer

context_timestamp().strftime('%Y-%m-%d %H:%M') gives 'NoneType' object is not callable
error in odoo 14 with dt.dt.now() or with a datetime field or without parameter :(

Thanks a lot brother, this is the best answer

베스트 답변

I have just created a module which allows you do to:

<span t-usertime="%Y-%m-%d %H-%M-%S" /> 

and get the correct timezone. See it on GitHub 

아바타
취소

This has now been accepted in the OCA addons. Updated the github link.

베스트 답변

Hi Vince,

    Can we add current datetime into Studio report also?

Thanks

아바타
취소
관련 게시물 답글 화면 활동
1
7월 25
1848
1
5월 25
1931
1
4월 25
2373
1
2월 25
1664
0
10월 24
1440