Subject Re: [firebird-support] Preceding Zero for a Month extracted from a Date
Author Ivan Prenosil
CASE WHEN EXTRACT(MONTH FROM PA.StartDate)<10 THEN 0 ELSE '' END || EXTRACT(MONTH FROM PA.StartDate)

Ivan
http://www.volny.cz/iprenosil/interbase/


----- Original Message -----
From: "Christian G├╝tter" <news@...>
To: <firebird-support@yahoogroups.com>
Sent: Thursday, August 18, 2005 12:05 PM
Subject: [firebird-support] Preceding Zero for a Month extracted from a Date


> Hi folks,
>
> within a bigger select statement, I am using
> the following code to extract the month out
> of a given date and then to concatenate the
> date in a different format:
> ...
> EXTRACT(MONTH FROM PA.StartDate) AS StartMonth || '.' ||
> ...
>
> In this case, e.g. August is extracted as '8', but I would
> like to have months smaller then October shown
> with a preceding zero, e.g. '08' for August.
>
> Normally, I would use CASE for this, but CASE does only
> work with columns.
>
> Does anyone know an elegant way to do this or do I have to find
> a workaround (e.g. let the client modify the date)?
>
>
> Christian