SoftTech wrote:
> Does anyone know how I can accomplish this from within a stored procedure?
> 
> I need to convert a timestamp 01/26/2012 05:38:32am to a string 
> 01262012053832.
> 
> Will actually be using CURRENT_TIMESTAMP within the stored procedure.

You could use EXTRACT() to extract day, month, year, hour, etc. and use 
|| operator to concatenate numbers into string. To make sure numbers are 
zero padded you can use STR_PAD or CASE like this:

case when number < 10 then '0'||number else number end

I mention CASE because STR_PAD is not available in older versions of FB.

Alternatively there are UDF libraries (rfunc for example) that provide 
date format functions. So you could write something like:

DateToStr(current_timestamp, '%d%m%Y%h%M%S')

> Still using Firebird 1.5.3 (Hope to convert down the road)

In that case, use DateToStr or CASE.

-- 
Milan Babuskov

==================================
The easiest way to import XML, CSV
and textual files into Firebird:
http://www.guacosoft.com/xmlwizard
==================================

Reply via email to