AJAX Forums

Code in XSLT to compare dates?

This is a discussion on Code in XSLT to compare dates? within the XML and XSLT forums, part of the Beginners AJAX category; What should be the code written in XSLT that will allow me to compare dates from a SQL Server (let's say, SQLExpress)?...


Go Back   AJAX Forums > Beginners AJAX > XML and XSLT

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Old 10-27-2007, 01:20 PM   #1 (permalink)
Junior Member
 
Join Date: Oct 2007
Posts: 3
Rep Power: 0 Melay is on a distinguished road
Code in XSLT to compare dates?

What should be the code written in XSLT that will allow me to compare dates from a SQL Server (let's say, SQLExpress)?
__________________
Melay is offline   Reply With Quote
Old 10-27-2007, 01:20 PM   #2 (permalink)
Junior Member
 
Join Date: Oct 2007
Posts: 3
Rep Power: 0 jake cigar™ is retired is on a distinguished road
if the dates are stored as integer it's simple, if they are strings yyyymmdd, also easy.

if they are messy US style you have to do a lot of manipulation.

http://www.dpawson.co.uk/xsl/sect2/dates.html

make sure the sql select reformats the the date to a natural format for simple comparisons
XSLT 2.0 can compare date values directly (once they're in ISO format).

XSLT 1.0 can only compare numbers. You can convert an ISO date to a number by removing the punctuation: translate($in, '-', ''). To convert a US date to an ISO date, use a combination of substring() and concat().
__________________
jake cigar™ is retired is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
AJAX Jobs : price compare site by john111 admin AJAX Freelance Jobs 0 09-27-2008 11:32 AM
Code in XSLT to display current date? Melay XML and XSLT 1 10-27-2007 12:38 PM
please please convert the following XML to another XML with XSLT:? Partha G XML and XSLT 1 10-27-2007 12:30 PM
Where can I learn CSS, XSLT, and XML-RPC? IS dude XML and XSLT 3 06-08-2007 08:01 AM
SYS-CON Announces Two New "AJAXWorld University Bootcamp" Dates microbee AJAX Help 0 01-10-2007 08:15 PM


All times are GMT -4. The time now is 06:06 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5
Copyright ©2006 - 2008, AJAXwith.com