Custom Date Format help

Creating tables and queries

Custom Date Format help

Postby horrormaster34 » Thu Feb 14, 2008 5:21 am

I'm trying to make a custom date format so that only the year is required (YYYY). When I enter this as a user-defined format, the year will not change. No matter what year I enter, it will stay at 1905.
Posts: 1
Joined: Thu Feb 14, 2008 5:03 am

Re: Custom Date Format help

Postby DrewJensen » Thu Feb 14, 2008 5:44 am

There are some database engines ( MySQL being the most prominent of these ) that allow partial dates in a DATE field - the embedded Base database is not one of these.

If you have defined your column type as DATE or DATETIME or TIMESTAMP then a full date must be inserted into the column.

If you want a column that only holds a value representing a year then define it as an INT or CHAR.

Or - use a mask that take takes input for a year part, and automatically adds a month and day for example.

Use a pattern field and an edit mask of something like LLLLLLNNNN then a literal mask of "01/01/____" . With this the user can enter only a valid year.

Later when you use the field in a query simply use the YEAR function to extract this meaningful part
SELECT YEAR( <your date column> ) FROM table
for example.
Former member of The Document Foundation
Former member of Apache OpenOffice PMC
LibreOffice on Ubuntu 18.04
User avatar
Posts: 1734
Joined: Sat Oct 06, 2007 9:01 pm
Location: Cumberland, MD - USA

Return to Tables & Queries

Who is online

Users browsing this forum: No registered users and 3 guests