Showing posts with label Sql Date formats. Show all posts
Showing posts with label Sql Date formats. Show all posts

Wednesday, October 18, 2017

Show all Date Time Formats in Sql Server

SQL Query
 DECLARE @i int=0  
 L1:  
 IF @i<200  
 BEGIN  
      BEGIN TRY  
           print convert(nvarchar(max),@i+0) +'. ' + convert(nvarchar(max),getdate(),@i)  
      END TRY  
      BEGIN CATCH  
      END CATCH  
      SET @i = @i + 1  
      GOTO L1  
 END  

Output
 0. Oct 19 2017 10:30AM  
 1. 10/19/17  
 2. 17.10.19  
 3. 19/10/17  
 4. 19.10.17  
 5. 19-10-17  
 6. 19 Oct 17  
 7. Oct 19, 17  
 8. 10:30:56  
 9. Oct 19 2017 10:30:56:513AM  
 10. 10-19-17  
 11. 17/10/19  
 12. 171019  
 13. 19 Oct 2017 10:30:56:513  
 14. 10:30:56:513  
 20. 2017-10-19 10:30:56  
 21. 2017-10-19 10:30:56.513  
 22. 10/19/17 10:30:56 AM  
 23. 2017-10-19  
 24. 10:30:56  
 25. 2017-10-19 10:30:56.513  
 100. Oct 19 2017 10:30AM  
 101. 10/19/2017  
 102. 2017.10.19  
 103. 19/10/2017  
 104. 19.10.2017  
 105. 19-10-2017  
 106. 19 Oct 2017  
 107. Oct 19, 2017  
 108. 10:30:56  
 109. Oct 19 2017 10:30:56:517AM  
 110. 10-19-2017  
 111. 2017/10/19  
 112. 20171019  
 113. 19 Oct 2017 10:30:56:517  
 114. 10:30:56:517  
 120. 2017-10-19 10:30:56  
 121. 2017-10-19 10:30:56.517  
 126. 2017-10-19T10:30:56.517  
 127. 2017-10-19T10:30:56.517  
 130. 29 محرم 1439 10:30:56:517AM  
 131. 29/01/1439 10:30:56:517AM