Hello everyone I want to pick the current date of the system by using:
Select GETDATE()
It will give you the result
04/17/2013 06:37:35
But I just want 04/17/2013. Because I don't need the time.
Can anyone please help. Thanks in advance.
Hello everyone I want to pick the current date of the system by using:
Select GETDATE()
It will give you the result
04/17/2013 06:37:35
But I just want 04/17/2013. Because I don't need the time.
Can anyone please help. Thanks in advance.
You can convert it to a DATE
SELECT CONVERT(DATE, GETDATE())
Or convert it to a VARCHAR
SELECT CONVERT(CHAR(10), GETDATE(), 101)
The 101 is the format you've requested
Use this:
SELECT CONVERT(VARCHAR(10), GETDATE(), 101) AS [MM/DD/YYYY]
For more types of date please visit here.
Something along the lines of:
select convert(varchar(12), GetDate(), 1)
The convert functions third parameter provides a number of different format options for date format.