[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Date format

Subject: RE: Date format
From: "Ali Mutlu" <alimutlu@xxxxxxxxxxxx>
Date: Thu, 30 May 2002 19:56:11 +0300
xslt date format
Hi,

did you put

<xsl:text>20</xsl:text>

so the new template must be like


<xsl:template name="ConvertRtDate">
             <xsl:param name="ADate"/>
		<xsl:text>20</xsl:text>
                         <xsl:value-of select="substring($ADate,8,2)"/>
                         <xsl:choose>
....


or you can

<xsl:template name="ConvertRtDate">
             <xsl:param name="ADate"/>
                         <xsl:value-of
select="concat('20',substring($ADate,8,2))"/>
                         <xsl:choose>

....



both has to work

rgds
Ali


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of AXRAMAKR@xxxxxx
Sent: Thursday, May 30, 2002 19:27
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Cc: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx; xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Date format



Ali,
I'm sorry to bother you again...Changing it this way gives me 02 not 2002.
I guess my question is how to change 02 to 2002?
So the formatting of 17-MAY-02 should yield 20020517 not 020517.

Can we convert 2 digit year to 4 digit year?

Thanks,

Akila Ramakrishnan
(314) 768 5809
axramakr@xxxxxx



                      "Ali Mutlu"
                      <alimutlu@xxxxxxxxxxxx>           To:
<xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
                      Sent by:                          cc:
                      owner-xsl-list@xxxxxxxxxxx        Subject:  RE: 
Date format
                      rrytech.com


                      05/30/02 10:44 AM
                      Please respond to xsl-list






Akila,

replace the line
                   <xsl:value-of select="substring($ADate,8,4)"/>
with

<xsl:text>20</xsl:text>
<xsl:value-of select="substring($ADate,8,2)"/>


Rgds
Ali


-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]On Behalf Of AXRAMAKR@xxxxxx
Sent: Thursday, May 30, 2002 18:09
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Cc: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx; xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  Date format



Ali,
Thanks for your help. However, when I call the template like this
<xsl:call-template name="ConvertRtDate">
                  <xsl:with-param name="ADate" select ="@trndte"/>
            </xsl:call-template>

The date of 17-MAY-02 gets converted to 020517. How do I make it 20020517?

Thanks,

Akila




                      "Ali Mutlu"
                      <alimutlu@xxxxxxxxxxxx>           To:
<xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
                      Sent by:                          cc:
                      owner-xsl-list@xxxxxxxxxxx        Subject:  RE: 
Date format
                      rrytech.com


                      05/30/02 08:15 AM
                      Please respond to xsl-list






>> I have a date 17-MAY-02 from the oracle database that I would like to
>> format as YYYYMMDDHR24MI and another date 117-MAY-02 to be converted to
>> YYYYMMDD.

>> I wish to do the transformation in the XSLT. Has anyone done this before
>> and if so how did you do it?


Akila,

The following template translates anything like dd-mmm-yyyy to yyyymmdd, I
beleive a shorter way may exists, but it works

Rgds
Ali


<xsl:template name="ConvertRtDate">
             <xsl:param name="ADate"/>
                         <xsl:value-of select="substring($ADate,8,4)"/>
                         <xsl:choose>
                                     <xsl:when test="substring($ADate,4,3)
='JAN'">
                                                 <xsl:value-of select
="'01'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='FEB'">
                                                 <xsl:value-of select
="'02'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='MAR'">
                                                 <xsl:value-of select
="'03'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='APR'">
                                                 <xsl:value-of select
="'04'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='MAY'">
                                                 <xsl:value-of select
="'05'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='JUN'">
                                                 <xsl:value-of select
="'06'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='JUL'">
                                                 <xsl:value-of select
="'07'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='AUG'">
                                                 <xsl:value-of select
="'08'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='SEP'">
                                                 <xsl:value-of select
="'09'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='OCT'">
                                                 <xsl:value-of select
="'10'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='NOV'">
                                                 <xsl:value-of select
="'11'"/>
                                     </xsl:when>
                                     <xsl:when test="substring($ADate,4,3)
='DEC'">
                                                 <xsl:value-of select
="'12'"/>
                                     </xsl:when>
                         </xsl:choose>
             <xsl:value-of select="substring($ADate,1,2)"/>
</xsl:template>







 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list






 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list






 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • RE: Date format, (continued)
    • AXRAMAKR - Thu, 30 May 2002 11:18:33 -0400 (EDT)
      • Ali Mutlu - Thu, 30 May 2002 11:55:38 -0400 (EDT)
    • AXRAMAKR - Thu, 30 May 2002 12:36:30 -0400 (EDT)
      • Wendell Piez - Thu, 30 May 2002 12:54:26 -0400 (EDT)
      • Ali Mutlu - Thu, 30 May 2002 13:06:38 -0400 (EDT) <=

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.