Date&time:
[sql]
–2014-02-14 02:14:00
SELECT CONVERT(VARCHAR, GETDATE(),120)
–20140214021400
select replace(replace(replace(CONVERT(varchar, getdate(), 120 ),’-‘,”),’ ‘,”),’:’,”)
–Feb 14 2014 2:14:00:214PM
SELECT CONVERT(VARCHAR, GETDATE(),109)
[/sql]
Date:
[sql]
–02/14/2014
SELECT CONVERT(VARCHAR, GETDATE(),101)
–2014.02.14
SELECT CONVERT(VARCHAR, GETDATE(),102)
–14/02/2014
SELECT CONVERT(VARCHAR, GETDATE(),103)
–14.02.2014
SELECT CONVERT(VARCHAR, GETDATE(),104)
–14-02-2014
SELECT CONVERT(VARCHAR, GETDATE(),105)
–14 Feb 2014
SELECT CONVERT(VARCHAR, GETDATE(),106)
–Feb 14, 2014
SELECT CONVERT(VARCHAR, GETDATE(),107)
–02-14-2014
SELECT CONVERT(VARCHAR, GETDATE(),110)
–2014/02/14
SELECT CONVERT(VARCHAR, GETDATE(),111)
–20140214
SELECT CONVERT(VARCHAR, GETDATE(),112)
[/sql]
Time:
[sql]
–02:14:00
SELECT CONVERT(VARCHAR, GETDATE(),108)
–02:14:00:214
SELECT CONVERT(VARCHAR, GETDATE(),114)
[/sql]