How can I change date format to YYYY-MM-DD in a View?

How can I change the date format to YYYY-MM-DD in a View? For example, for this field:

Also, any way to change the column name?

Thank you

1 « J'aime »

column name can be changed from domains, you might need to change title of column, right?

1 « J'aime »

Hi Siddique,

Thank you. Let my clarify my questions:
(a) How can I change the date format displayed in grid View cells to YYYY-MM-DD?
(b) How can I change the column name (title) in a grid View?

1 « J'aime »

hi @marty ,
Which version you are using ?

6.3.3, hopefully moving on to 6.5.3 at some point in the future

So…, any ideas?

You can try this

<field name="birthDate" string="Birth Date (YYYY-MM-DD)">
  <viewer><![CDATA[
#if ($value)
  ${value.toLocalDate().format("yyyy-MM-dd")}
#end
  ]]></viewer>
</field>

This would probably work locally in one view for one field. But how to do it system-wide, i.e. globally?

Still didn’t get an answer as to « How can I change the column name (title) in a grid View »?

Hi @marty , try as Siddique say:
« column name can be changed from domains, you might need to change title of column, right? »

Check this link:
https://docs.axelor.com/adk/6.1/dev-guide/models/models.html

Hi, I did something like that, but:

  • you will lose internazionalization (all the data will be appear always in that format in all the languages)
  • is a customization of the core

Inside « form.converters.js » i made this change

  //var dateFormat = (mm.localeData()._longDateFormat.L || 'DD/MM/YYYY')
  var dateFormat=('DD-MM-YYYY')

it will change the data everywhere and all keeps working (saving, sort, etc).

Is not fancy, but it works