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
 General SQL Server Forums
 New to SQL Server Programming
 SQL Date Display

Author  Topic 

TheAce
Starting Member

1 Post

Posted - 2008-12-09 : 17:18:34
Hi All
Im testing a new sql database i have set up ready for my new internet business and i am having trouble getting my dates to display properly they are currently being displayed 01/01/01 00:00:00. I just want the date to display and not the time can someone help me solve this problem.

Many Thanks

SELECT [Customer].[Title],[Customer].[First Name],[Customer].[Last Name], 
[Orders].[Date Ordered] AS 'Last Ordered On',
[Order Product].[Quantity] AS 'Quantity Brought',[Customer].[E-mail]


FROM Customer
INNER JOIN Address ON Customer.AddressID = Address.AddressID
INNER JOIN Orders ON Address.AddressID = Orders.[Delivery AddressID]
INNER JOIN [Order Product] ON Orders.OrderID = [Order Product].OrderID
INNER JOIN Product ON [Order Product].ProductID = Product.ProductID


WHERE [Orders].[Date Ordered] <= '01/01/2008' AND [Date Ordered] >= '01/01/2004'
AND [Order Product].[Quantity] > 2


ORDER BY [Last Ordered On] ASC


hanbingl
Aged Yak Warrior

652 Posts

Posted - 2008-12-09 : 17:26:16
select convert(varchar(10),[Date Ordered], 101)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-10 : 02:38:41
Try doing formatting at your front end application if possible. its not a good idea to change dates to varchar in sql as it will make date manipulations complex.
Go to Top of Page
   

- Advertisement -