SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 29th, 2002, 06:20 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
Comparing Dates in ASP

<i><b>Originally posted by : Jimmy (jimmy_jian@hotmail.com)</b></i><br />I have a question about comparing dates in SOL.<br />I try to select record from database according to the date using:<br />Orders.Source = "SELECT * From Table WHERE SomeDate BETWEEN " & "#" & BeginDate & "#" & " AND " & "#" & EndDate & "#"<br /><br />where BeginDate and EndDate are all in format mm/dd/yyyy and I believe the field "SomeDate" in database is with type "TEXT" and format mm/dd/yyyy<br /><br />The result seems that in this way, the Dates are compared by value of "String" instead of "Date", which is not what I want. I type using CAST in my SQL command, Like CAST(SomeDate AS Date), it did n't work either.<br /><br />I don't think I can change the data type in database. So is there any way I can solve my problem?<br /><br />Thank you for your help.<br /><br /><br /><br />Jimmy<br /><br />

Reply With Quote
  #2  
Old May 30th, 2002, 04:22 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Mohammad Jamous (jamouss@hotmail.com)</b></i><br />Hi Jimmy<br /><br />I face this problem before and i solve it like this way<br /><br />u have to convert the String of Date to Date or DateTime object and that come like this<br />********************<br />dim dt as DateTime<br /><br />dt = CDate(BeginDate)<br /><br />be care that BeginDate should be in this format (MM/dd/yyyy hh:mm:ss tt) for DateTime and (MM/dd/yyyy) for Date else it will give u an exception.<br /><br />If you need any more info , u can send me an Email.<br /><br />Best Regards<br /><br /><br />------------<br />Jimmy at 5/29/2002 4:20:36 PM<br /><br />I have a question about comparing dates in SOL.<br />I try to select record from database according to the date using:<br />Orders.Source = "SELECT * From Table WHERE SomeDate BETWEEN " & "#" & BeginDate & "#" & " AND " & "#" & EndDate & "#"<br /><br />where BeginDate and EndDate are all in format mm/dd/yyyy and I believe the field "SomeDate" in database is with type "TEXT" and format mm/dd/yyyy<br /><br />The result seems that in this way, the Dates are compared by value of "String" instead of "Date", which is not what I want. I type using CAST in my SQL command, Like CAST(SomeDate AS Date), it did n't work either.<br /><br />I don't think I can change the data type in database. So is there any way I can solve my problem?<br /><br />Thank you for your help.<br /><br /><br /><br />Jimmy<br /><br />

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Comparing Dates in ASP


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway