Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

How to convert datetime to date

Could someone help me display the below formula as a date only:

CONVERT(varchar(10), getdate() - 4, 101)

Thanks a bunch!!

0
luv2kids
Asked:
luv2kids
  • 2
1 Solution
 
brainboltCommented:
Not sure what you mean.  Can you give an example of what you are wanting to get.

BTW, what DB are you using? SQL Server? Which version?
0
 
luv2kidsAuthor Commented:
SQL Server 2000

The code as is displays:  2008-10-20 00:00:00.000
I want it to display as: 2008-10-20
0
 
brainboltCommented:
I'm running SQL Server 2000 and when I execute the following in Query Analzyer:

select CONVERT(varchar(10), getdate() - 4, 101)

I get "10/28/08"

Where are you running the query?
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now