Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
5 Trả lời
9840 Lượt xem

How can I change my date format - DD/MM/YYYY in odoo 11?

Ảnh đại diện
Huỷ bỏ

Date formatting in python for odoo:

1- https://goo.gl/VNJgWS

2- https://goo.gl/1y5Esp

Câu trả lời hay nhất

Hi Anupam:

You need to use a language that uses this date format, for example, English (UK) and set that as the user's preferred Language in the user settings.

If the required language is not available for selection in the Language dropdown, you will need to activate developer mode,  go to Settings > Translations > Languages and activate the required language.

Ảnh đại diện
Huỷ bỏ

You can modify the date format in the language. I did that for english (UK) so it fits Norwegian way of reading / enter a date. Be aware that it can be overwritten when upgrade. Also decimal separator and thousand separator can be modified in the language.

Is there any solution for specific date field format to change?

Hi Haresh: Please provide more details of what you are looking for.

Câu trả lời hay nhất

Hi,

In "Developer mode" go to Settings > Translations > Languages > select the language you are using and edit it however you want, in your case, set the date to:  %d/%m/%Y

Thanks

Ricardo

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Are you asking about changing the whole datetime fields?
else you can easily do it using python Datetime library's strftime

>>> import datetime

>>> do = datetime.datetime.strptime("Dec 17 2014 00:00:06", "%b %d %Y %H:%M:%S")

>>> do.strftime("%Y-%m-%d %H:%M:%S")
Ảnh đại diện
Huỷ bỏ