A date YYYYMMDD Macro for BASE

Discuss the database features

A date YYYYMMDD Macro for BASE

Postby cub001 » Sat Nov 17, 2018 1:55 pm

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
cub001
 
Posts: 27
Joined: Thu Sep 27, 2012 9:29 pm
Location: Metropolis IL Hometown of SUPERMAN WB7PNC

Re: A date YYYYMMDD Macro for BASE

Postby Villeroy » Sat Nov 17, 2018 2:07 pm

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

Code: Select all   Expand viewCollapse view
SELECT Replace("Date_Field",'-','')AS "Digits" FROM "Table"
converts a date field into a sequence of 8 digits.
Code: Select all   Expand viewCollapse view
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, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 26868
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Base

Who is online

Users browsing this forum: No registered users and 5 guests