how to convert the datetime value to hour
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 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)
?
精彩评论