Subject | Preceding Zero for a Month extracted from a Date |
---|---|
Author | Christian Gütter |
Post date | 2005-08-18T10:05:46Z |
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
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