SharePoint - Conditional formatting with dates

Asked By Jorge Colon
08-Feb-10 01:50 PM

I have a list where the date column changes color depending on how far away it is from the current date.  The code seems to work fine except when the specified date crosses into the following month.  For example, if today's date is within 7 days of Feb 28, 2010, the column changes to yellow. Lets say today's date is Feb 27, 2010.  This is within 7 days, the column changes to yellow.  However, if I change the column's date to Mar 1, 2010, it doesn't change to yellow, despite today being within 7 days of the column date.  Initially, I've tried this with 30 and 60 day conditions, but I've temporarily changed it to 3 and 7 day conditions for testing.  I had believe that the "number(translate(xxx))" function converts the date to a numeric value that increases by 1 everyday.  So I don't understand why this combination of conditions doesn't work beyond the current month.  Any thoughts on this topic?  Has anyone else run into a similar problem?

<xsl:attribute name="style">
  <xsl:if test="number(translate(substring-before(@Close_x0020_Out_x0020_Date,'T'),'-','')-7) &gt; number(translate(substring-before($Today,'T'),'-',''))">background-color: #008000; font-weight: bold;</xsl:if>
  <xsl:if test="number(translate(substring-before(@Close_x0020_Out_x0020_Date,'T'),'-','')-7) &lt;= number(translate(substring-before($Today,'T'),'-',''))" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">background-color: #FFFF00; font-weight: bold;</xsl:if>
  <xsl:if test="number(translate(substring-before(@Close_x0020_Out_x0020_Date,'T'),'-','')-3) &lt;= number(translate(substring-before($Today,'T'),'-',''))">background-color: #FFA521; font-weight: bold;</xsl:if>
  <xsl:if test="number(translate(substring-before(@Close_x0020_Out_x0020_Date,'T'),'-','')) &lt; number(translate(substring-before($Today,'T'),'-',''))">background-color: #FF0000; font-weight: bold;</xsl:if>
</xsl:attribute>

<xsl:value-of disable-output-escaping="no" select="ddwrt:FormatDate(string(@Close_x0020_Out_x0020_Date),number($Language),1)" />

  Alon Havivi replied to Jorge Colon
09-Feb-10 02:11 PM
It's look like there is comparison between the current date DAY and the selected date DAY... without considering the month or year values.
Create New Account
help
SharePoint Designer and Conditional Formatting SharePoint Hi, I have the following problems \ questions with SharePoint Designer: 1. I want to change the background color of a row when the availability date of a person is more then 30 days in the past from today. I opened allitems.aspx from the site and then I convert that to xslt. Then I do conditional formatting and I can choose current date etc. . . Only I do not know and I cannot find it anywhere how to get the background changed if the date is in the past (30 days from today). I need to change something in the
Sharepoint 2003 conditional formatting based on date field SharePoint Hi, I need some help! I am trying to use Frontpage to apply conditional formatting to a Sharepoint 2003 list data view. The list has a date field, and I want to format the rows in the view 3 different colors based upon that date field and the current date. I am hoping this is possible using an advanced expression
WSS v2.0 / FrontPage Conditional Formatting SharePoint Is there a reason that conditional formatting in a data view displays properly in FrontPage but not when the site is displayed through the browser / WSS v2.0? (Browser = Internet Explorer v6.1) I have a date column that has 2 possible color formattings based on value. I have tried changing the of the condition statements in the XML but still receive the same results. Thanks. Rhonda SharePoint Design Discussions SPCap.aspx (1) SharePoint (1) SPCAP (1) WindowsServices (1) Rhonda (1) AE5BEE3E1CF3 (1) Formattings (1) Cjvandyk (1) You might Thanks C Blog: http: / / www.cjvandyk.com / blog RSS: http: / / feeds.feedburner.com / cjvandyk SPCAP - SharePoint Capacity Planning Tool http: / / www.cjvandyk.com / blog / aspx / SPCap.aspx keywords: WSS, v2.0, / , FrontPage, Conditional, Formatting description: Is there a reason that conditional formatting in a data view displays properly
Sharepoint and conditional formatting function SharePoint I have a spreadsheet with conditional formatting and would like to set up a list that provides similar functionalit. In other visual representation of the status e.g. red, yellow, green. Any help would be appreciated. SharePoint Discussions SharePoint (1) SPD (1) Christophe (1) Harris (1) Window (1) Month (1) Meta (1) Week (1 to try this: http: / / pathtosharepoint.wordpress.com / 2008 / 09 / 01 / apply-color-coding-to-your-sharepoint-lists / http: / / pathtosharepoint.wordpress.com / 2008 / 09 / 02 / a-progress-bar-for-your-tasks-list / The advantage of this method is that it's all done through the SharePoint UI, no need for SharePoint Designer. Christophe The following article explains how to configure a
Issue with Conditional Formatting SharePoint Hey all, I am attempting to perform the following if date is less than today go red if today go blue if tomorrow or future green the main issue i am having is the date field is there any way to get the XSL or something to use the system date or will i be required to use a single coulum with the current system date? SharePoint Portal Server Discussions SharePoint Designer 2007 (1) SharePoint (1) MOSS 2007 (1) PaulGalvinsSharepointSpace (1) Conchango (1) Thedesigner (1) Coulum