Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to get shorter date format (without time stamp

Author  Topic 

jbon
Starting Member

20 Posts

Posted - 2009-09-11 : 02:08:15
Hi,
I get data from one table into a gridview and one of the columns is a date. I get it with date and time stamp but I want solely the date in my gridview, how can I achieve this.

This is what I get: 2009-08-04 00:00:00

This is what I want: 2009-08-04

Thanks in advance!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-09-11 : 02:10:18
just format it in your frond end application

or

convert to date data type

convert(date, datetimecol)


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Andreas
Starting Member

11 Posts

Posted - 2009-09-20 : 11:04:07
If you want to change the way the date value looks like you can convert it to a string and use the style-parameter:
convert(varchar(10), '2009-08-04 00:00:00', 120)


See http://msdn.microsoft.com/en-us/library/ms187928.aspx
Go to Top of Page
   

- Advertisement -