Subject Re: [firebird-support] Re: Date problem in Firebird
Author Pavel Menshchikov
Hello,

s> when i pass the "SQL" to my custom search grid,it will show the
s> records. There is no formatting in my grid,so I should format it in
s> the query itself. The above query worked well in oracle,but in
s> firebird the concatenation making prblms.
I think your client side formats dates implicitly.

s> So if the only way is to use any UDF,pls give the necesary codes for
s> that.
There exists EXTRACT function (AFAIR, it is in SQL standard):
EXTRACT(YEAR from <your_date_field>)
EXTRACT(MONTH from <your_date_field>)
EXTRACT(DAY from <your_date_field>)
So, you may construct stuff like
select
extract(month from dt_start) || '/' ||
extract(day from dt_start) || '/' ||
extract(year from dt_start) as dt_start,
extract(month from dt_end) || '/' ||
extract(day from dt_end) || '/' ||
extract(year from dt_end) as dt_end,
extract(month from dt_start) || '/' ||
extract(day from dt_start) || '/' ||
extract(year from dt_start) || ' - ' ||
extract(month from dt_end) || '/' ||
extract(day from dt_end) || '/' ||
extract(year from dt_end) as sham
from year_setup
without using UDFs. Note that the result contains no leading zeros.


HTH
--
Best regards,
Pavel Menshchikov
http://www.ls-software.com