Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListFormat date in XSL templateFormat date in XSL template
Previous
 
Next
New Post
5/21/2007 12:58 PM
 

Hi, how can I format a date in a XSL template? I have an UDT date field wich I want to show in a certain format. Does UDT support that or do I need to create a template inside my XSL just to do that? I usually need information on these UDT XSL formatting tips, but I have never found documentation on that and I always need to ask these questions here in the Forum. My UDT's version is the one packed with DNN 4.3.4. Thanks!

 
New Post
5/21/2007 5:12 PM
 

If you have a date column "theDate", you can select the values theDate and  theDate_UDT_Value. The later one contains a formated. localized date.

If you need more, you will need to play with theDate. Perhaps this code fragment helps you:

<xsl:template name="OutputValue">
    <xsl:param name="Value"/>
    <xsl:param name="FieldType"/>
    <xsl:if test="$Value">
        <!--DateTime looks like "2005-12-31T23:59:55.0000000+01:00" -->
        <xsl:variable name="Year" select="substring($Value, 1, 4) "/> 
        <xsl:variable name="Month" select="substring($Value, 6, 2) "/> 
        <xsl:variable name="Day" select="substring($Value, 9, 2) "/>
        <xsl:variable name="Time" select="substring($Value, 12, 8) "/>
        <xsl:choose>
            <xsl:when test="$FieldType='Date' or $FieldType='ChangedAt' or $FieldType='CreatedAt'">
                <xsl:value-of select ="$Month"/>/<xsl:value-of select ="$Day"/>/<xsl:value-of select ="$Year"/>
            </xsl:when> 
            <xsl:when test="$FieldType='DateTime'">
                <xsl:value-of select ="$Month"/>/<xsl:value-of select ="$Day"/>/<xsl:value-of select ="$Year"/><xsl:text> </xsl:text> <xsl:value-of select="$Time"/>    
            </xsl:when> 
            <xsl:when test="$FieldType='Time'">    
                <xsl:value-of select="$Time"/>
            </xsl:when> 
            <xsl:otherwise>
                <xsl:value-of select="$Value" disable-output-escaping="yes"/>
            </xsl:otherwise> 
        </xsl:choose>
    </xsl:if>
</xsl:template>
 
New Post
5/25/2007 9:25 AM
 

Hey, Stefan, Thanks a lot! Regards, Marcos

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListFormat date in XSL templateFormat date in XSL template


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out