Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Format Text Based on Date

Posted on 2005-05-13
1
Medium Priority
?
215 Views
Last Modified: 2010-04-25
Hi all,

I am using DreamWeaver and Coldfusion.  I have a site that lists outstanding action items.  I would like to be able to make dates which are before today appear in red to make them stand out.

Is there a coding solution to this?

Here is my page code in case it is needed, the field in question is called ByWhen:



<cfparam name="URL.ByWhom" default="1">
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfparam name="PageNum_FollowupContacts" default="1">
<cfquery name="FollowupContacts" datasource="UKContacts">
SELECT VisitReportID, FollowupID, Item, Details, ByWhom, ByWhen, ActionCompleted
FROM FollowUpTable
WHERE ActionCompleted = 0 and ByWhom = '#URL.ByWhom#'
ORDER BY ByWhen DESC</cfquery>
<cfset MaxRows_FollowupContacts=10>
<cfset StartRow_FollowupContacts=Min((PageNum_FollowupContacts-1)*MaxRows_FollowupContacts+1,Max(FollowupContacts.RecordCount,1))>
<cfset EndRow_FollowupContacts=Min(StartRow_FollowupContacts+MaxRows_FollowupContacts-1,FollowupContacts.RecordCount)>
<cfset TotalPages_FollowupContacts=Ceiling(FollowupContacts.RecordCount/MaxRows_FollowupContacts)>
<cfset QueryString_FollowupContacts=Iif(CGI.QUERY_STRING NEQ "",DE("&"&XMLFormat(CGI.QUERY_STRING)),DE(""))>
<cfset tempPos=ListContainsNoCase(QueryString_FollowupContacts,"PageNum_FollowupContacts=","&")>
<cfset ActionCompleted_Checked ="">
<cfif tempPos NEQ 0>
  <cfset QueryString_FollowupContacts=ListDeleteAt(QueryString_FollowupContacts,tempPos,"&")>
</cfif>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style2 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; }
.style3 {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: 10px;
      font-weight: bold;
}
-->
</style>
</head>

<body>

<p align="center" class="style1">All Outstanding Follow Up Actions for <strong><cfoutput>#FollowupContacts.ByWhom#</cfoutput></strong></p>
<p align="center" class="style3">Please note if you select to view the CCR, please use your back button on the browser to return to this page. </p>
<p class="style1">&nbsp;</p>

<table border="1" align="center">
  <tr>
    <td class="style2"><div align="center">Click Action ID to Edit CCR </div></td>
    <td class="style2"><div align="center">View CCR Relating to Action </div></td>
    <td class="style2"><div align="center">Item</div></td>
    <td class="style2"><div align="center">Details</div></td>
    <td class="style2"><div align="center">Owner</div></td>
    <td class="style2"><div align="center">By When</div></td>
  </tr>
  <cfoutput query="FollowupContacts" startRow="#StartRow_FollowupContacts#" maxRows="#MaxRows_FollowupContacts#">
    <tr>
      <td class="style1"><div align="center"><a href="actionedit.cfm?recordID=#FollowupContacts.FollowupID#">#FollowupContacts.FollowupID#</a></div></td>
      <td class="style1"><form name="form1" method="post" action="rpts/cvr/cvrmain-dynamic-cee.asp">
        <div align="center">
          <p>
            <input type="submit" name="Submit" value="View CCR">
            <input name="P1" type="hidden" id="P1" value="#FollowupContacts.VisitReportID#">
            </p>
          </div>
      </form></td>
      <td width="15" class="style1"><div align="center">#FollowupContacts.Item# </div></td>
      <td class="style1">#FollowupContacts.Details# </td>
      <td class="style1"><div align="center">#FollowupContacts.ByWhom# </div></td>
      <td class="style1"><div align="center">#LSDateFormat(FollowupContacts.ByWhen,'DD MMMM YYYY')# </div></td>
    </tr>
  </cfoutput>
</table>
<span class="style1"><br>
</span>
<table border="0" width="50%" align="center">
  <cfoutput>
    <tr>
      <td width="23%" align="center" class="style1"><cfif PageNum_FollowupContacts GT 1>
          <a href="#CurrentPage#?PageNum_FollowupContacts=1#QueryString_FollowupContacts#">First</a>
        </cfif>
      </td>
      <td width="31%" align="center" class="style1"><cfif PageNum_FollowupContacts GT 1>
          <a href="#CurrentPage#?PageNum_FollowupContacts=#Max(DecrementValue(PageNum_FollowupContacts),1)##QueryString_FollowupContacts#">Previous</a>
        </cfif>
      </td>
      <td width="23%" align="center" class="style1"><cfif PageNum_FollowupContacts LT TotalPages_FollowupContacts>
          <a href="#CurrentPage#?PageNum_FollowupContacts=#Min(IncrementValue(PageNum_FollowupContacts),TotalPages_FollowupContacts)##QueryString_FollowupContacts#">Next</a>
        </cfif>
      </td>
      <td width="23%" align="center" class="style1"><cfif PageNum_FollowupContacts LT TotalPages_FollowupContacts>
          <a href="#CurrentPage#?PageNum_FollowupContacts=#TotalPages_FollowupContacts##QueryString_FollowupContacts#">Last</a>
        </cfif>
      </td>
    </tr>
  </cfoutput>
</table>
<cfoutput><span class="style1">Records #StartRow_FollowupContacts# to #EndRow_FollowupContacts# of #FollowupContacts.RecordCount# </span></cfoutput>
</body>
</html>
0
Comment
Question by:sr_millar
1 Comment
 
LVL 55

Accepted Solution

by:
Ryan Chong earned 1000 total points
ID: 14001338
You can try use the DateDiff function to determine whether a date is smaller than today or not, and then set the display color accordingly.

DateDiff("datepart", "date1", "date2")

try like:

...

<cfif DateDiff("d", FollowupContacts.ByWhen, Now()) gt 0>
                  <cfset color = "##FF0000">
            <cfelse>
                  <cfset color = "##000000">
            </cfif>            
      <td class="style1"><div align="center"><font color="#color#">#LSDateFormat(FollowupContacts.ByWhen,'DD
          MMMM YYYY')# </font></div></td>

...

Hope this helps, regards
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question