|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
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>"
|
|
#2
|
||||
|
||||
|
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. |
|
#3
|
||||
|
||||
|
hmm.. it gets stored in the database as date/time.... does it make a difference?
![]() |
|
#4
|
|||
|
|||
|
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) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > datediff problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|