0

I would like to check if the processed date is today. xsl:if test="ProcessedDate = 'Today'" won't work since the value of processed date is a timestamp more like 2016-06-07T09:06:54.827z How can I mathematically convert it to check the processed date to see if it's in the past 24 hrs. Perhaps within a ().

Aron
  • 1
  • 1
  • The real problem here is getting the value of the current dateTime, which is not available natively in XSLT 1.0. Which XSLT processor will you be using? -- Also please clarify if you want to check if the given dateTime is today or within the last 24 hours - those are two different things. – michael.hor257k Jun 07 '16 at 21:59
  • when I place xsl:value-of select="sw:ToShortDate(ShippedDate)" it returns 06/09/2016. I'd like it to check in a test xsl:if test="ShippedDate = 'Today'" even though the actual value isn't today. It's possible it's not xslt since I really am not a professional in this I'm just editing a template that pulls order information. Perhaps it's xmlns. – Aron Jun 09 '16 at 16:34
  • I am afraid that makes no sense to me at all. `xsl:if test="ShippedDate = 'Today'"` will return true only if the `ShippedDate` element contains the literal text string `Today`. -- If you're not sure which XSLT processor you'll be using, find out - see here how: http://stackoverflow.com/questions/25244370/how-can-i-check-which-xslt-processor-is-being-used-in-solr/25245033#25245033 – michael.hor257k Jun 09 '16 at 17:10
  • P.S. `sw:ToShortDate()` is an extension function not available in native XSLT. You should explain what your processing environment is, as date manipulations are quite difficult to manage in XSLT 1.0, and if your processor has extra functions, you should take advantage of them. – michael.hor257k Jun 09 '16 at 17:42

0 Answers0