Date comparison in SharePoint views

  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.
  • : Function split() is deprecated in /hsphere/local/home/guruj/guruj.net/modules/filter/filter.module on line 1200.

It can be a real pain to successfully filter views in SharePoint Designer based on Date Ranges in XSLT List Views because SharePoint doesn't seem to be able to parse date comparisons. Possibly using ISO8601 format would work but this seems to require the use of custom SharePoint code which I am working on ways to avoid!

The only option is to convert the Dates and/or Times you want to compare to a serial value using a Calculated column, like so:


=DATE(YEAR(Date),MONTH(Date),DAY(Date))
 +TIME(HOUR(Date),MINUTE(Date),SECOND(Date))

or if you want dates to match if they have the same dates but different times, then simply:


=DATE(YEAR(Date),MONTH(Date),DAY(Date))

Comparing these serial values in SharePoint Designer will work.

UPDATE: Spoke too soon! The comparisons can work using XSLT, but not using the CAML filter mechanisms -- I still have no idea why. See my follow up post for the fix.