The problem
In QGIS 3.34 Prizren, I have an attribute field of date type. Unfortunately, years are shown only with two digits: 23 instead of 2023. As a historian, this is really bad as it could be also 1923, 1823 etc. I know that internally, QGIS uses the correct, 4-digit year values. But for reading the attribute table, I want to see the full numbers.
The Question
How can I show the date in a format with years with actual, four-digit numbers?
What I tried
I tried to use format_date("date", 'dd. MM. yyyy'), however, to no avail: in the preview, the desired format shows up, but when the field is created, all values are set to NULL. This applied to temporary scratch layers as well as to GeoPackage layers.
I also tried Menu Settings > Options > General. I can change the Locale settings, but this does not affect the two-digit representation of the years.
The issue seems to be a newer one, as a year before (must have been QGIS 3.28), with the same settings, I had 4-digit numbers for the year (compare with 2nd screenshot below). Setting the locale to "French France" works (after restart of QGIS, using hint of @user30184). However, I would like to get 4-digit years in my locale "German Switzerland" as it was possible in older versions.
It is also strange that in my Windows 10 system Region settings, the year appears in 4 digits, even the "short version" (see screenshot, highlighted in red). It seems that in newer versions, QGIS does not respect system settings...
A workaround
I could, of course, create a new field of type text/string and create a correctly looking date, but I try to avoid this as it is not very elegant and error-prone.






format_datereturns a string representation of a date, which means that you cannot enter it into a field of type "Date". That's why those are all NULL.