Tuesday, 17 October 2017

Sql server Sort date format


select CONVERT(varchar(12),getdate(),1) --// Result 10/18/17
select CONVERT(varchar(12),getdate(),2) --// Result 17.10.18
select CONVERT(varchar(12),getdate(),3) --// Result 18/10/17
select CONVERT(varchar(12),getdate(),4) --// Result 18.10.17
select CONVERT(varchar(12),getdate(),5) --// Result 18-10-17
select CONVERT(varchar(12),getdate(),6) --// Result 18 Oct 17
select CONVERT(varchar(12),getdate(),7) --// Result Oct 18, 17
select CONVERT(varchar(12),getdate(),8) --// Result 11:16:55
select CONVERT(varchar(12),getdate(),9) --// Result Oct 18 2017
select CONVERT(varchar(12),getdate(),10) --// Result 10-18-17

select CONVERT(varchar(12),getdate(),11) --// Result 17/10/18
select CONVERT(varchar(12),getdate(),12) --// Result 171018
select CONVERT(varchar(12),getdate(),13) --// Result 18 Oct 2017            select CONVERT(varchar(12),getdate(),14) --// Result 11:15:40:210

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...