dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Date Format Conversion

Hybrid View

  1. #1
    Join Date
    Jul 2007
    Posts
    11

    Date Format Conversion

    Hello XML Guru'z,

    I need to convert a date format but I'm sort of new to XSL and having trouble figuring this out. I've tried all kinds of date conversion functions but to no avail.

    I'm receiving the string as <requestDate>20090925</requestDate>

    and I need to display it as '09/25/2009'

    what is the best approach for this and is there a system function that can do this or does it require a use function?

    Thanks for any help!
    codeHermit

  2. #2
    Join Date
    Oct 2009
    Posts
    6
    Just try this XSL by which you can generate your required output i.e. 09/25/2009:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">
    <xsl:template match="*">
    <xsl:value-of select="concat(substring(.,5,2), '/',substring(.,7,2),'/', substring(.,1,4))"/>
    </xsl:template>
    </xsl:stylesheet>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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



Recent Articles