ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

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 Dev Shed Forums Sponsor:
  #1  
Old October 19th, 2003, 10:27 PM
icepricessa's Avatar
icepricessa icepricessa is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 199 icepricessa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 10 m 38 sec
Reputation Power: 6
datediff problem

hi there i have an if else satemement and this part here checks to see if today's date is eactly two weeks away from the expirydate in the database.... however nothing happens so when i did a resopopnse.write i got the datediff difference of 223 ??!! how do i solve this problem?

Code:
ElseIf DateDiff("d", FormatMediumDate(created), FormatMediumDate(objRS("ExpiryDate"))) = 14 Then 
		Response.Write "<div class='Change7'><font color='#FF0000'><b>"&FormatMediumDate(objRS("ExpiryDate"))&"</b</font></div>"

Reply With Quote
  #2  
Old October 20th, 2003, 06:38 AM
OldJacques's Avatar
OldJacques OldJacques is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: in Orbit mostly
Posts: 148 OldJacques User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
FormatMediumDate??

What is the outout of your FormatMediumDate(date) function (and the value assigned to the two dates)? Are you sure it is a vaild date (and not a String which looks like a date - maybe try using a varType or an IsDate check to see what the Server thinks it is)?

You might need to pass it through CDate before using it if the datediff isn't recognizing it correctly.

Reply With Quote
  #3  
Old October 21st, 2003, 08:38 PM
icepricessa's Avatar
icepricessa icepricessa is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 199 icepricessa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 10 m 38 sec
Reputation Power: 6
hmm.. it gets stored in the database as date/time.... does it make a difference?

Reply With Quote
  #4  
Old October 21st, 2003, 09:00 PM
pda8333 pda8333 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 216 pda8333 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 6 m 31 sec
Reputation Power: 6
i think one of your date is not a datetime format.
(date = 10/22/2003)

e.g
<%=DateDiff("d", "10/18/2003", date)%>
output is 4

whereas if i put this, it will show out differently
<%=DateDiff("d", 10/18/2003, date)%>
output is 37916.

i think your scenario would be the second one.
__________________
Hope this helps.

Mike
Royal Selangor Pewter

"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > datediff problem


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 4 hosted by Hostway
Stay green...Green IT