Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

obtaining date without stamp time

$
0
0


The datetime is stored in the table as the following:
2014-03-03 00:00:00.000
2014-03-03 00:00:00.000
2014-03-03 00:00:00.000
2014-03-03 00:00:00.000
2014-03-03 00:00:00.000
2014-03-03 00:00:00.000
2014-03-04 00:00:00.000

The following code is written inside view to obtain date only

MAX(Substring(Convert(char,[Order date],110),1,10)) AS [Order Date]
....

where [order date] between '20140303' and '20140307'


The problem is when I used the above syntax, I was surprised to see in the output out of the date range. when I took out the substring and convert function it will bring the expected results but still the datetime or time stamp is there and I want to date

The expected results
2014-03-03
2014-03-03
2014-03-03
2014-03-03
2014-03-03
2014-03-03
2014-03-04

How I could solve this problem




Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>