///////////// query
1.
1.
select CONVERT(varchar(5), [ColumnName],8)+' '+ RIGHT(convert(varchar,
[ColumnName], 100),
2) from
tableName
// result
12:52 PM
2.
select convert(varchar, getdate(), 108)+ ' ' + RIGHT(convert(varchar, getdate(), 100), 2) as Time
// result
16:23:01
PM
3.
SELECT Convert( VarChar( 10 ), CAST(getdate() AS TIME(0)), 100 )
// result
4:23PM
4.
SELECT ltrim(right(convert(varchar(20), getdate(),108), 7))+' '+ RIGHT(convert(varchar, getdate(), 100), 2)
// result
6:25:04 PM
No comments:
Post a Comment