Wednesday, January 8, 2014

Sql Server get Date String

this is for example you have to change char("number") ;


select CONVERT(CHAR(8),GETDATE(),112) = 20140108
select CONVERT(CHAR(16),GETDATE(),110) = 01-08-2014    
select CONVERT(CHAR(16),GETDATE(),111) = 2014/01/08    


select CONVERT(CHAR(30),GETDATE(),100) = 01  8 2014  6:06PM      
select CONVERT(CHAR(30),GETDATE(),101) = 01/08/2014                        
select CONVERT(CHAR(30),GETDATE(),102) = 2014.01.08                  
select CONVERT(CHAR(30),GETDATE(),105) = 08-01-2014                  

No comments:

Post a Comment