Query changes my date formatting

Hi Everyone,

I am having a database (libreoffice 5.2 base) with a Date field. It is formatted as 31/12/2016.
I then have a query where I want the date to show but with a different format. I want only the two last digits of the year.

I other words I want it to show as such…

table: 31/12/2016 -----> query: 16

I there a way to achieve that?

Many thanks.

Ciao,
Use this code in query:

RIGHT( YEAR( "Date" ), 2 )

If my answer helped you, vote it with :heavy_check_mark: and with ∧ (here on the left)

Hi

There is another way if you need to keep the field as a date:

  • Create a view instead of a query (same syntax)
  • Open the view, Right Click the date header▸Column Format▸update the format code, close the view.

The format is preserved (this manipulation is not preserved for queries) and the field is still a date. E.g. you can use DAY(DateField) in a query for instance.

Regards