Solved

How to convert datetime to date

Posted on 2008-10-24
3
307 Views
Last Modified: 2012-06-21
Could someone help me display the below formula as a date only:

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

Thanks a bunch!!

0
Comment
Question by:luv2kids
  • 2
3 Comments
 
LVL 2

Expert Comment

by:brainbolt
ID: 22799875
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
 

Author Comment

by:luv2kids
ID: 22799924
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
 
LVL 2

Accepted Solution

by:
brainbolt earned 500 total points
ID: 22799976
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1. Set up your parameter at the report level as usual, check the box Multi-value, and set the Data Type to String 2. Set the Stored Procedure Parameter to varchar(max)  --<---- This part here is the key to it's success Example:    @cst_key var…
Hi, In my previous Article  (http://www.experts-exchange.com/Database/Reporting/A_15199-Introduction-to-Microstrategy.html)I discussed some basic understanding of Microstrategy that how we can get in Intro of Microstrategy (MSTR). Now it's tim…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now