DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Need help in Xpath query for comparing a date with todays date

  1. #1
    Join Date
    Jan 2009

    Question Need help in Xpath query for comparing a date with todays date

    Very new to xml and xslt

    This is the XML
    <order id="V123-0" name="Management" type="Transfer" date="2008-11-25T15:18:39" sourceSystem="pjs" sourceSystemId="AGS05026112" sourceSystemUser="Z" operator="Z">

    Can someone help me to get write an Xpath query for comparing order date with todays date...

  2. #2
    Join Date
    Apr 2007
    Sterling Heights, Michigan
    You didn't say what version of XPath you are using.

    XPath 1.0 only supports number comparison. As such, if your date format is yyyy-mm-dd then you can use e.g.
    translate('2009-01-27', '-', '') > translate(someDate, '-', '')
    This will convert the date to a number and thehn the numbers are compared.

    Other options are EXSLT.NET, see or switching to XPath 2.0 or XQuery 1.0, supported by Saxon from, as XPath 2.0 or XQuery 1.0 support date and dateTime comparisons.

Similar Threads

  1. Query a date from database
    By matrik02 in forum VB Classic
    Replies: 0
    Last Post: 05-11-2007, 12:33 AM
  2. Totals query for the last date
    By Samotek in forum VB Classic
    Replies: 1
    Last Post: 11-01-2005, 03:46 AM
  3. Replies: 8
    Last Post: 08-09-2002, 08:00 AM
  4. Query help with date
    By neena in forum VB Classic
    Replies: 2
    Last Post: 03-27-2002, 12:29 PM
  5. Query by Today's date
    By Andy Burns in forum Database
    Replies: 1
    Last Post: 01-04-2002, 10:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center