Web developers wiki ASP.NET Sitecore Sharepoint Kentico by Evident Interactive

How to: select sitecore items based on datetime field

Modified: 2009/07/09 10:00 by jim - Categorized as: Sitecore
I was trying to render a set of Sitecore items based on whether their startdate is in the future.

It is not possible to compare date fields, it is not possible to test whether 'xxx' > 'yyy'

This was my solution:
    <xsl:variable name="futuretraininglist" select="$traininglist/item[ pinktext:IsFuture(sc:fld('StartDate', .)) ]" />
where pinktext:IsFuture returns true or false and the Sitecore StartDate field is parsed and compared to DateTime.Now.

 © Evident Interactive BV