Skip to Content
Menu
This question has been flagged
1 Atsakyti
2858 Rodiniai

How to set my date default value as 05/08/2022??

Portretas
Atmesti
Best Answer

You can do it as below:

my_date = fields.Date(string='My Date', default=lambda self: fields.Date.context_today(self).replace(day=8,month=5,year=2022))

Portretas
Atmesti
Autorius

It's working, where we can define the specific date format like DD/MM/YYYY

You can change it from Languages, Enable developer mode then Go to Settings -> Translations -> Languages -> open your language and edit the date format field to %d/%m/%Y

Autorius

I tried the same but date showing 2022-05-08

You need to refresh the page. Which screen you check it?

Related Posts Replies Rodiniai Veikla
1
birž. 25
1721
3
liep. 25
3338
1
geg. 25
1485
1
geg. 25
1743
4
geg. 25
2875