Subject | Re: [firebird-support] Preceding Zero for a Month extracted from a Date |
---|---|
Author | Mitchell Peek |
Post date | 2005-08-18T22:13:15Z |
Christian Gütter wrote:
select substring( Cast( EXTRACT(MONTH FROM current_Date) +100 as
VarChar(3)) from 2) as StartMonth
from rdb$database
Mitch
>Hi folks,Another option..
>
>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
>
>
>
select substring( Cast( EXTRACT(MONTH FROM current_Date) +100 as
VarChar(3)) from 2) as StartMonth
from rdb$database
Mitch