How to compare two dates in DS format SQL.SMALLDATETIME
Moderators: chulett, rschirm, roy
How to compare two dates in DS format SQL.SMALLDATETIME
I want ot compare to dates 1999/01/02 and 2000/01/02 and the answer that i get is wrong
snassimr,
please explain how you are comparing them? If you do a "1999/02/02" = "2000/01/02" you are going to a get a 0 {wrong}. What are you trying to compare - their equality? Days between?
please explain how you are comparing them? If you do a "1999/02/02" = "2000/01/02" you are going to a get a 0 {wrong}. What are you trying to compare - their equality? Days between?
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Since the format is yyyy/mm/dd you can do a simple string comparison, so your result of doing a ( '2000/01/01' > '1999/01/01' ) will return true. What is the condition you are testing - so that we might see why you state that it is wrong...
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: