CONVERT datetime stamp to date

I have a field that I would like to only display the date as mm/dd/yyyy.  Current field shows mm/dd/yyyy hh:mm:ss AM.

I would most likely create a view that will create a field that will display the date only.  
chippylesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

KarinLoosCommented:
use the convert function  ie:
select  convert( varchar(20), datetimefieldname, 101 )

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LowfatspreadCommented:
give the points to Karin ,
but i'd use

select  convert( char(10), datetimefieldname, 101 )

its going to be 10 characters at most , and even with leading zeros being suppressed the additional 2 byte length
overhead of varchar is too much...

lfs
 
 
0
chippylesAuthor Commented:
Do I get my points back.  I found the solution before the answer was posted?
0
wtf666Commented:
since i had to do the same thing in sql server so i used this query for conversion and then applying criteria on ur conversion function ::. thought might be helpful for someone else :)

SELECT     TOP 100 PERCENT dbo.BillTo.Company AS CustName, dbo.BillTo.City, dbo.Salseman.Name AS SalesRep, dbo.BillTo.AccountNo AS CustNo,
                      dbo.Orders.OrderNo, dbo.Orders.Total, dbo.Orders.EnteredDate, CONVERT(CHAR(10), dbo.Orders.EnteredDate, 101) AS _EnteredDate,
                      dbo.Orders.ReqDate, dbo.Orders.EnteredBy
FROM         dbo.Salseman INNER JOIN
                      dbo.BillTo INNER JOIN
                      dbo.Orders ON dbo.BillTo.RecordID = dbo.Orders.BillToID ON dbo.Salseman.SalesmanID = dbo.Orders.SalesmanID
WHERE     (dbo.Orders.EnteredDate IS NOT NULL) AND (CONVERT(CHAR(10), dbo.Orders.EnteredDate, 101) >= CONVERT(DATETIME, '3/29/2005 00:00:00', 102))
                      AND (CONVERT(CHAR(10), dbo.Orders.EnteredDate, 101) <= CONVERT(DATETIME, '3/30/2005 00:00:00', 102))
ORDER BY dbo.Orders.Total DESC


adios
Ade
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.