LibreOffice Base: add field year

Need to create a YEAR in the table in the four-digit form (2021), which type of field to choose?

I chose [Date], format code YYYY.

The default value is 1900, but when making changes I can’t edit the year (I just want to specify 4 digits, not count days from 1900)

Hello,

In a database, a DATE field is represented as YYYY-MM-DD no matter your locale or the mode of display you use (ie: dd/mm/yy). You can set a default date but not partial defaults such as month or day.

For this reason, if you do not wish to use an actual date, use an Integer or Small Integer to store your year.

As an aside, there are a number of bugs with the date control. This depends upon the version of LO being used (you have not stated this or the database you are using)

Hi!

Last version LO Base 7.1.1.2

@nitamatin,

Base is not a database but a front end to a database. Although LO ships with HSQLDB and Firebird embedded, you can use a variety of other databases. FYI, the database you are using is on the status bar (bottom of frame) of the main Base screen. The DB is in the center and the connection type is to the left.

Regardless, the LO version you are using does have many problems with settings for date controls. For example, a minimum or maximum date can be set (with difficulty) but will not be retained. This is in the version I use on Ubuntu 20.04