SELECT CURRENT_TIMESTAMP AS [Right now], CONVERT(VARCHAR, CURRENT_TIMESTAMP, Style) AS [Formatted text], Style AS [Style used], 'CONVERT(VARCHAR, CURRENT_TIMESTAMP, ' + CAST(Style AS VARCHAR) + ')' AS Example FROM ( SELECT 0 as Style UNION ALL SELECT 100 UNION ALL SELECT 1 UNION ALL SELECT 101 UNION ALL SELECT 2 UNION ALL SELECT 102 UNION ALL SELECT 3 UNION ALL SELECT 103 UNION ALL SELECT 4 UNION ALL SELECT 104 UNION ALL SELECT 5 UNION ALL SELECT 105 UNION ALL SELECT 6 UNION ALL SELECT 106 UNION ALL SELECT 7 UNION ALL SELECT 107 UNION ALL SELECT 8 UNION ALL SELECT 108 UNION ALL SELECT 9 UNION ALL SELECT 109 UNION ALL SELECT 10 UNION ALL SELECT 110 UNION ALL SELECT 11 UNION ALL SELECT 111 UNION ALL SELECT 12 UNION ALL SELECT 112 UNION ALL SELECT 13 UNION ALL SELECT 113 UNION ALL SELECT 14 UNION ALL SELECT 114 UNION ALL SELECT 20 UNION ALL SELECT 120 UNION ALL SELECT 21 UNION ALL SELECT 121 UNION ALL SELECT 126 UNION ALL SELECT 127 UNION ALL SELECT 130 UNION ALL SELECT 131 ) AS xSource
Labels
- linux (21)
- script (15)
- css (12)
- bash (9)
- cli (9)
- customize (8)
- stylish (7)
- windows (6)
- firefox (5)
- userchrome.css (5)
- xbmc (5)
- ahk (3)
- autohotkey (3)
- command line (3)
- tt-rss (3)
- ubuntu (3)
- SQL (2)
- automation (2)
- batch (2)
- config (2)
- google reader (2)
- javascript (2)
- mpd (2)
- photos (2)
- spotify (2)
- virtualbox (2)
- API (1)
- GW2 (1)
- Guild Wars 2 (1)
- SQL Server (1)
- android (1)
- animals (1)
- arch linux (1)
- backup (1)
- bukkit (1)
- c# (1)
- cross browser (1)
- curl (1)
- debian (1)
- deluge (1)
- ext.net (1)
- facebook (1)
- flexget (1)
- flowers (1)
- gentoo (1)
- greasemonkey (1)
- kodi (1)
- openbox (1)
- pidgin (1)
- python (1)
- raspberry (1)
- rpi (1)
- scriptish (1)
- tasker (1)
- tellstick (1)
- tmux (1)
- update (1)
- video (1)
- youtube (1)
Thursday, October 27, 2011
Convert datetime in SQL Server
This query gives you examples of possible datetime convertion formats.