Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 12th, 2009, 01:14 PM
Registered User
 
Join Date: Nov 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default Need Date Format in XSLT

Hi ,

I get the date in the below format in one element :
2009-06-17T00:00:00

and need to convert and format the same in to 06172009.

I need to do that in XSLT . can some body please suggest me some thing.

Any help is appreciated.

Pavan
Reply With Quote
  #2 (permalink)  
Old November 12th, 2009, 01:26 PM
Friend of Wrox
Points: 6,673, Level: 34
Points: 6,673, Level: 34 Points: 6,673, Level: 34 Points: 6,673, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,242
Thanks: 0
Thanked 244 Times in 243 Posts
Default

Well with XSLT/XPath 2.0 you could create an xs:dateTime(foo) and then use methods like format-dateTime http://www.w3.org/TR/xslt20/#function-format-dateTime.
Code:
  <xsl:template match="foo">
    <xsl:value-of select="format-dateTime(xs:dateTime(.), '[M01][D01][Y0001]')"/>
  </xsl:template>
With XSLT/XPath 1.0 you will need to use string functions e.g.
concat(substring(foo, 6, 2), substring(foo, 9, 2), substring(foo, 1, 4))
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
Reply With Quote
The Following User Says Thank You to Martin Honnen For This Useful Post:
garinapavan (November 12th, 2009)
  #3 (permalink)  
Old November 12th, 2009, 02:49 PM
Registered User
 
Join Date: Nov 2009
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks Martin
Reply With Quote
Reply


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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
date format differs, need to force format somehow patricolsson ASP.NET 2.0 Basics 1 December 2nd, 2009 11:53 PM
How to format date using XSLT navi25584 XSLT 3 September 2nd, 2008 07:00 AM
Convert British format date to American format? fyr PHP How-To 0 December 19th, 2007 02:17 PM
XSLT - Convert the date in different format haixia XSLT 1 August 25th, 2006 11:51 AM
Date format in XSLT rk2203 XSLT 2 November 29th, 2005 03:10 AM



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


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.