Subject | RE: [firebird-support] Re: Formating date to yyyymmdd |
---|---|
Author | Michel Veerman |
Post date | 2009-06-12T13:37:21Z |
>> selectdate)))
>> extract(year from cast('today' as date))
>> || substring(cast(cast((100 + extract(month from cast('today' as
>> as integer) as varchar(100)) from 2 for 2)date)))
>> || substring(cast(cast((100 + extract(day from cast('today' as
>> as integer) as varchar(100)) from 2 for 2)current_date), 2, '0') ...
>>
>> from rdb$database
>
>I think using LPAD (and current_date) is a lot easier and readable:
>
>select extract(year from current_date) || lpad(extract(month from
True, but it's an UDF. Not that it should matter much, but some people
are allergic to them :-).
(may require an additional cast to varchar, no access to Firebird here).
I still think this is a presentation issue that should not be handled by
the database.
Sometimes it's simply easier and quicker to do it all in one SQL script.
Especially when it's a do-it-once-and-then-throw-away-the-code program
:-).
But for a full blown program, I agree with you.
Kind regards,
Michel Veerman
[Non-text portions of this message have been removed]