开发者

how to convert the datetime value to hour

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜