<%
intVal=2497
' Obtain the months
intMM=int(intVal/30)
Response.Write intMM&"=Months<br>"
' Obtain remainder
intMML=intVal-(30*intMM)
' Calculate weeks (if any)
if intMML/7 >= 1 then
intWW=int(intMML/7)
Response.Write intWW&"=Weeks<br>"
intDD=intMML-(7*intWW)
Response.Write intDD&"=Days"
else
' Calculate days (if any)
intDD=intMML
Response.Write intDD&"=Days"
end if
%>
<%
Response.Write "<form action=""DateDiff.asp"" method=""post"" name=""DateDiff"">" & vbNewLine & _
"<table width=""30%"" align=""center"" bgcolor=""cyan"" borders=""0"" cellpadding=""1"" cellspacing=""3"">" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""center"" bgcolor=""lightcyan"" colspan=""6"">Date Difference" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""center"" bgcolor=""lightgrey"" colspan=""6"">" & vbNewLine & _
" <input style=""text-align: center; text-decoration:blink;"" type=""text"" name=""Val"" size=""5"" maxlength=""5"" value=""" & Request.Form("Val") & """>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""middle"">" & vbNewLine & _
" <td align=""center"" bgcolor=""lightcyan"" width=""(100/6)%"">Months" & vbNewLine & _
" </td>" & vbNewLine
intVal=Request.Form("Val")
intMM=int(intVal/30)
strMM=cStr(intMM)
intMML=intVal-(30*intMM)
if intMML/7 >= 1 then
intWW=int(intMML/7)
strWW=cStr(intWW)
intDD=intMML-(7*intWW)
strDD=cStr(intDD)
if intDD=0 then strDD="0"
else
strWW="0"
intDD=intMML
strDD=cStr(intDD)
if strDD="" then strDD="0"
end if
Response.Write " <td align=""center"" bgcolor=""white"" width=""(100/6)%"">" & strMM & "" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""lightcyan"" width=""(100/6)%"">Weeks" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""white"" width=""(100/6)%"">"& strWW & "" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""lightcyan"" width=""(100/6)%"">Days" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""white"" width=""(100/6)%"">" & strDD & "" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>" & vbNewLine & _
"<center><input type=""submit"" value=""Submit"" id=""submit""></center>" & vbNewLine & _
"</form>" & vbNewLine
%>
The datepart isn't going to use a standard 30 day monthMaybe because 30 days isn't standard for a month? And the OP's premise that using 30 day months would be easier isn't correct, you have to do a lot more coding to deal with a non-calendar month interval since all the hard work about dealing with dates has already been done for you when you use the built-in date functions.