Problem with DateDiff and Date/Time value.
The form below displayed perfectly until I added the line for DateDiff between VacStart and VacEnd. I receive an error message;
An error occurred while evaluating the expression:
#DateDiff("w", "VacStart", "VacEnd")#
Error near line 48, column 51.
Parameter 2 of function DateDiff which is now "VacStart" must be a date/time value
The error occurred while processing an element with a general identifier of (#DateDiff("w", "VacStart", "VacEnd")#), occupying document position (48:50) to (48:86).
I have tried changing the DB value to Date/Time as well as Text and get the same result each time. Any help would be greatly appreciated. Here is my code:
<cfquery datasource="manna_premier" name="TM_log">
SELECT *
FROM TMStatusLog
</cfquery>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>TM Status Log</title>
</head>
<body>
<p align="center" class="style4">Territory Manager Status Log </p>
<table width="1448" border="0">
<tr>
<th width="71"><span class="style3">ID No.#</span></th>
<th width="88"><span class="style3"> Date</span></th>
<th width="166"><span class="style3">TM Name</span></th>
<th width="129"><span class="style3">Status</span></th>
<th width="139"><span class="style3">Vac Start </span></th>
<th width="137"><span class="style3">Vac End</span></th>
<th width="203">Ttl Days </th>
<th width="203"><span class="style3">DSR Ride Along Name</span></th>
<th width="274"><span class="style3">Service Call Name</span></th>
</tr><cfoutput query="TM_log">
<tr>
<td><span class="style3">#ID#</span></td>
<td><div align="center"><span class="style3">#DateFormat(LogDate, "mm/dd/yyyy")#</span></div></td>
<td><div align="center"><span class="style3">#TerritoryManager#</span></div></td>
<td><div align="center"><span class="style3">#Status#</span></div></td>
<td><div align="center"><span class="style3">#DateFormat(VacStart, "mm/dd/yyyy")#</span></div></td>
<td><div align="center"><span class="style3">#DateFormat(VacEnd, "mm/dd/yyyy")#</span></div></td>
<cfif VacStart IS NOT "Null">
<td><div align="center"><span class="style3">#DateDiff("w", "VacStart", "VacEnd")#</span></div></td>
</cfif>
<td><div align="center"><span class="style3">#DSRName#</span></div></td>
<td><div align="center"><span class="style3">#ServiceName#</span></div></td>
</tr></cfoutput>
</table>
</body>
</html>
