Format Firebird SQL data dd/mm/yyyy

Asked

Viewed 904 times

-1

How to convert a date to dd/mm/yyyy format in Firebird ?

I tried some ways to convert 2020/06/22 to format but always come out in YYYY/MM/DD format:

CONVERT(DATE, DATA, 103) AS "Data"
REPLACE(CONVERT(DATE, DATA, 1), '/', '') AS [DDMMYYYY]

1 answer

1

The databases, not exclusive to Firebird, store the dates by the numeric representation, the date type in Firebird stores in a 32bit integer, so the desired behavior depends on where you will manipulate the date and not Firebird.

select current_date as dataatual
, extract(week from current_date) as semana
, extract(weekday from current_date) as diasemana
, extract(day from current_date) as dia
, extract(month from current_date) as mes
, extract(year from current_date) as ano
, cast(current_date as char(10)) as formatoso
, extract(day from current_date) || '/'  || extract(month from current_date) || '/' || extract(year from current_date) as dataajustada
from rdb$database

Browser other questions tagged

You are not signed in. Login or sign up in order to post.