Solved

How to convert datetime to date

Posted on 2008-10-24
3
306 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

6 Experts available now in Live!

Get 1:1 Help Now