hamacker wrote:

Is there a way to format a datetime inside a query ?

When I use a CAST function to convert datetime to string:

CAST(SUBSTRING(CAST(a.LAST_UPDATE as varchar(30)) FROM 1 FOR 10) <- Get only date, without a time.

This cast returns date in format YYYY-MM-DD, but I would like to see DD-MM-YYYY for concatenation purposes. Of curse that I can use SUBSTRING to get day, month and year separately, but its too long to be written.

I prefer to change this format (and concatenation) inside my client application, so I'd like to know if there is any function to easy format date/time directly on server.

Milan Babuskov answers:

You can find some interesting ideas here, ranging from UDFs to SUBSTRING tricks: http://www.firebirdfaq.org/faq314

Like this post? Share on: TwitterFacebookEmail

Related Articles


Firebird Community



Gems from Firebird Support list