Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 17th, 2014, 06:59 AM
Registered User
 
Join Date: Jul 2013
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Question compare dates in xslt

Hi,

I would like to compare date from incoming field and system date.

Any suggestions.

Thanks,
 
Old April 17th, 2014, 09:52 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

(a) what format are the dates?

(b) are you using XSLT 2.0?
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old April 17th, 2014, 10:22 AM
Registered User
 
Join Date: Jul 2013
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Question

Dates are in dd/MM/yyyy and using 1.0

Thanks
 
Old April 17th, 2014, 10:34 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

OK, that's about the worst possible answer: XSLT 1.0 has no date arithmetic and no regular expression support.

Use substring() and concat() to convert the dates to format YYYYMMDD, then treat these as numbers and compare them as numbers. To get the system date you'll have to pass it in to the stylesheet as a parameter.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compare two dates lakshmi_annayappa Javascript 1 September 3rd, 2007 08:52 AM
How do I compare 2 dates? Lucy Classic ASP Basics 1 May 3rd, 2005 07:24 PM
Compare dates langer123 Classic ASP Basics 2 April 16th, 2005 08:57 AM
Compare dates [problem]... Varg_88 VB Databases Basics 3 August 20th, 2004 09:55 AM
Compare Dates in JS apd8x Javascript 4 June 16th, 2003 08:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.