A date YYYYMMDD Macro for BASE

Discuss the database features
Post Reply
User avatar
cub001
Posts: 27
Joined: Thu Sep 27, 2012 9:29 pm
Location: Metropolis IL Hometown of SUPERMAN WB7PNC

A date YYYYMMDD Macro for BASE

Post by cub001 »

I looked at the Macro "DateTime2' but was unable to implement it into Base. Do we have a macro that will work/key assign out here???
Thanks :)
Cub
Apache
OpenOffice Suite 4.1.6
Ask not what you can do for the computer, but what the computer can do for you.
................................................................................... Roberto C. Benitez.
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: A date YYYYMMDD Macro for BASE

Post by Villeroy »

Nobody knows the macro you have in mind, but simple SQL can do the trick.

Code: Select all

SELECT Replace("Date_Field",'-','')AS "Digits" FROM "Table"
converts a date field into a sequence of 8 digits.

Code: Select all

SELECT Cast(Substring("Digits", 1, 4)||'-'|| Substring("Digits", 5, 2)||'-'||Substring("Digits", 7, 2) AS DATE) AS "DateValues" FROM "Table"
converts the other way round.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply