Date format AAAA - 1999

I am trying to create a new format for date field, i only want the year number.

I create format code as AAAA but is impossible to record any date. If i write any number for example 1988, the number saved is 1905.

Dou you have any clue about this problem?

Thank you in advance

The Day 1988 since zero-date 1899-12-30 is the date 1905-06-10

Yes, your expectations about dates and their formats are wrong

1 Like

If you store the plain year number, the DATE function can calculate any specific date in that year like this: =DATE(A1;12;31)
If A1 has 1988, the formula returns 32508 which is the day number of the day 1988-12-31.

No matter how you display it (i.e., independent of format string), a date in Calc is a specific day X, where X is “number of days since epoch”.

No matter what date acceptance pattern you use, you can’t make Calc recognice a simple number as a date. When you enter 1988, it will always be recognized as number 1988, not as some day in year 1988 (which would be a number around 32000+). When you later tell LibreOffice to show you number 1988 as date, it counts which day was epoch + 1988 days, learns that (with the default epoch) it was 1905-06-10, and shows you the year of it.

For your purposes: why usual numeric format is not OK to store just year numbers?

i was following a student guide to create a database with some restrictions but seems that somethings are wrong, i will use a simple integer with 4 numbers to avoid this problem, thank you so much