SQL Server : convert string with format dddd mm/dd/yy to date -
how can convert string format dddd mm/dd/yy
date in sql server?
e.g. wednesday 1/9/13
once eliminate day of week, can convert rest of value.
the following works:
select cast(right(col, len(col) - charindex(' ', col)) date) (select 'wednesday 1/9/13' col) t;
edit:
aaron makes point. can ensure conversion using convert
style of "1":
select convert(date, right(col, len(col) - charindex(' ', col)) , 1) (select 'wednesday 1/9/13' col) t;
(101 doesn't work because expects 4-digit year.)
Comments
Post a Comment