The following conversion options are available for sql datetime format with century:
select convert(char, getdate(), 100) -- mon dd yyyy hh:mmAM (or PM) FROM TABLENAME
select convert(char, getdate(), 101) -- mm/dd/yyyy
select convert(char, getdate(), 102) -- yyyy.mm.dd
select convert(char, getdate(), 103) -- dd/mm/yyyy
select convert(char, getdate(), 104) -- dd.mm.yyyy
select convert(char, getdate(), 105) -- dd-mm-yyyy
select convert(char, getdate(), 106) -- dd mon yyyy
select convert(char, getdate(), 107) -- mon dd, yyyy
select convert(char, getdate(), 108) -- hh:mm:ss
select convert(char, getdate(), 109) -- mon dd yyyy hh:mm:ss:mmmAM (or PM)
select convert(char, getdate(), 110) -- mm-dd-yyyy
select convert(char, getdate(), 111) -- yyyy/mm/dd
select convert(char, getdate(), 112) -- yyyymmdd
select convert(char, getdate(), 113) -- dd mon yyyy hh:mm:ss:mmm
select convert(char, getdate(), 114) -- hh:mm:ss:mmm(24h)
select convert(char, getdate(), 120) -- yyyy-mm-dd hh:mm:ss(24h)
select convert(char, getdate(), 121) -- yyyy-mm-dd hh:mm:ss.mmm
select convert(char, getdate(), 126) -- yyyy-mm-ddThh:mm:ss.mmm
No comments:
Post a Comment