开发者

how to convert the datetime value to hour

开发者 https://www.devze.com 2022-12-28 08:20 出处:网络
I have datetime value as 2010-04-07 09:00:00.000 2010-04-07 14:30:00.000 how to convert the 14:30 t开发者_StackOverflowo 2:30 pmSELECT RIGHT(CONVERT(varchar(7), Myvalue, 100), 7)

I have datetime value as

  1. 2010-04-07 09:00:00.000

  2. 2010-04-07 14:30:00.000

how to convert the 14:30 t开发者_StackOverflowo 2:30 pm


SELECT RIGHT(CONVERT(varchar(7), Myvalue, 100), 7)

Even better would be to do this in the client code...


Do you want to do it in a query if so look.

select date_format(date, "%Y-%m-%d %r") from table_name

also look at this

FOR MSSQL YOU SHOULD USE convert() method


gbn, didn't you mean SELECT RIGHT(CONVERT(varchar(AT-LEAST-19), Myvalue, 100), 7) ?

0

精彩评论

暂无评论...
验证码 换一张
取 消