Convert date from yyyy-mm-dd to dd/mm/yyyy

Version: 7.5.9.2 (X86_64) / LibreOffice Community
Build ID: cdeefe45c17511d326101eed8008ac4092f278a9
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: pt-BR (pt_BR.UTF-8); UI: pt-BR
Calc: threaded

Happy new year everyone. I’m looking for a way to convert a date I have inside a variable with the format yyyy-mm-dd to the format my country uses which is dd/mm/yyyy. I need it to be changed in order to be displayed to the user in the form.

YYYY-MM-DD is correct. DD/MM/YYYY is not. Dates aren’t used by countries, but by users.

The correct format as specified by ISO (ISO 8601) should be understood everywhere in the world meanwhile. It is the only unambiguous way to communicate dates globally in a human-readable way. It tells “I am a date” by the way. It sorts correctly alphabetically. Why do you want to replace a good representation by a bad one? This even under the tag “base” where items actually should be data.

Unfortunately you will again find somebody telling you that “dates are numbers” and how to “convert them to a different format”. Make your own decision.

Because it is easier for the final users of the database to understand whats happening behind the values I’m showing to them.

Which type of database are you using with Base?
What is the data type of the column storing the dates?

I’m using embedded HSQLDB.

The column storing the dates is set to Data type, and its format is dd/mm/yyyy. But I have an array that gets this values, and when it does it transforms them into yyyy-mm-dd. This creates my problem of having to transform it into dd/mm/yyyy again so it can be displayed properly.

Solved!

sub ConvertData
olddata = "2004-11-28"
data = Format(DateValue(olddata), "DD/MM/YYYY")
msgbox(data)
end sub

msgbox(data) shows 28/11/2004