Convert Date 'dd/mm/yyyy' to Date'mm/yyyy'?

UDA
Enthusiast

Convert Date 'dd/mm/yyyy' to Date'mm/yyyy'?

Dear whom tried before,
May I know, is it possible to convert the date format '31/5/2007' to date format '2007-05' by using SQL assistant?

Thanks. :-)
4 REPLIES
Enthusiast

Re: Convert Date 'dd/mm/yyyy' to Date'mm/yyyy'?

Hi,
Check this query whether it is help you.

SEL YEAR(CURRENT_DATE)||'-'||CASE WHEN MONTH(CURRENT_DATE)<10 THEN '0'||TRIM(MONTH(CURRENT_DATE)) else TRIM(MONTH(CURRENT_DATE)) END my_date
Enthusiast

Re: Convert Date 'dd/mm/yyyy' to Date'mm/yyyy'?

Dear sachinp17,
You are great.
Thank you!
Senior Apprentice

Re: Convert Date 'dd/mm/yyyy' to Date'mm/yyyy'?

Hi Benjamin,
you have to cast to a char to see a FORMAT in QueryMan:

select trim(date_col (format 'yyyy-mm'))

Dieter
Enthusiast

Re: Convert Date 'dd/mm/yyyy' to Date'mm/yyyy'?

Dear dnoeth,
Yes, I did. Thank you. :-)