GetDate
-
Hi, When I run the following select getdate(), I'm getting the value below: 2011-07-04 13:54:22.427 I want to get only the value 2011-07-04... Can anybody advise? Note: I don't want to convert it to varchar. Cheers
berba wrote:
Note: I don't want to convert it to varchar.
:doh: Try this Get Only DateTime Part without using Convert[^]
thatraja
**My Tip/Tricks
My Dad had a Heart Attack on this day so don't...
** -
Hi, When I run the following select getdate(), I'm getting the value below: 2011-07-04 13:54:22.427 I want to get only the value 2011-07-04... Can anybody advise? Note: I don't want to convert it to varchar. Cheers
If you are using SQL Server 2008 then use the
date
datatypeselect cast(getdate() as date)
returns 2011-07-04
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
If you are using SQL Server 2008 then use the
date
datatypeselect cast(getdate() as date)
returns 2011-07-04
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
Without using the convert function to manipulate the date then your best answer is from thatraja
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
Hi, When I run the following select getdate(), I'm getting the value below: 2011-07-04 13:54:22.427 I want to get only the value 2011-07-04... Can anybody advise? Note: I don't want to convert it to varchar. Cheers