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

AJAX Made Easy

Old 10-27-2007, 12: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
Sponsored Links
Old 10-27-2007, 12: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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads

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


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


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0
Copyright ©2006 - 2009, AJAXwith.com