我想在下午1:00时将列"Start"报告为1PM,或在下午1:15PM时将其报告为1:15PM。
[Start] = Case When Right(Convert(varchar,c.CourseStartTime), 5) = '00:00'
Then Format(Cast(c.CourseStartTime As Datetime), 'htt')
Else Format(Cast(c.CourseStartTime As Datetime), 'h:mmtt')End,
[End] = Case When Right(Convert(varchar,c.CourseEndTime), 5) = '00:00'
Then Format(Cast(c.CourseEndTime As Datetime), 'htt')
Else Format(Cast(c.CourseEndTime As Datetime), 'h:mmtt')End,
您的语法建议使用SQL Server。我认为replace()
和format()
可以满足您的要求:
select replace(format(getdate(), 'h:mmtt'), ':00', '')