Search code examples
sqlsql-serversql-server-2005datetime

SQL datetime format to date only


I am trying to select the DeliveryDate from sql database as just date. In the database, i am saving it as datetime format. How is it possible to get just date??

SELECT Subject, DeliveryDate 
from Email_Administration 
where MerchantId =@ MerchantID

03/06/2011 12:00:00 Am just be selected as 03/06/2011..

Thanks alot in advance! :)


Solution

  • After perusing your previous questions I eventually determined you are probably on SQL Server 2005. For US format you would use style 101

    select Subject, 
           CONVERT(varchar,DeliveryDate,101) as DeliveryDate
    from Email_Administration 
    where MerchantId =@MerchantID