Convert string to date

Database
Enthusiast

Convert string to date

Hello,

Can anybody help me convert a string to date format



20130421 convert to 2013-04-21 date format

 

 




2 REPLIES
Enthusiast

Re: Convert string to date

you can use:

select cast(cast('20130421' as date format 'yyyymmdd') as date format 'yyyy-mm-dd');

Enthusiast

Re: Convert string to date

Thank you! that worked.