sql - Convert Datetime format to varchar format style workaround -
i have datetime column need display in following format:
yyyy/mm/dd 00:00:00:000
with convert
, can't find suitable styles.
the /
in format important needs compared varchar
column has text yyyy/mm/dd 00:00
part of description below:
if can find way/style can use substring function compare value below:
diary item added : 2013/08/20 14:12
i have had at:
but, can't find sufficient styles has / 's. -'s.
you can use style closely resembles want compare on , use replace
replace -
\
.
select replace(convert(<yourstyle>),'-','/');
edit cudo's @bluefeet
select replace(convert(varchar(23), yourdate, 121),'-','/');
from technet: cast , convert
21 or 121 (2) odbc canonical (with milliseconds) yyyy-mm-dd hh:mi:ss.mmm(24h)
Comments
Post a Comment