Does anyone knows how to convert this date \'2018-09-24T00:00:00\' to this:
September 24th, 2018
using XSTL V1.0.
Try:
XML
<date>2018-09-24T00:00:00</date>
XSLT 1.0
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<output>
<xsl:variable name="month" select="substring(date, 6, 2)"/>
<xsl:choose>
<xsl:when test="$month=1">January</xsl:when>
<xsl:when test="$month=2">February</xsl:when>
<xsl:when test="$month=3">March</xsl:when>
<xsl:when test="$month=4">April</xsl:when>
<xsl:when test="$month=5">May</xsl:when>
<xsl:when test="$month=6">June</xsl:when>
<xsl:when test="$month=7">July</xsl:when>
<xsl:when test="$month=8">August</xsl:when>
<xsl:when test="$month=9">September</xsl:when>
<xsl:when test="$month=10">October</xsl:when>
<xsl:when test="$month=11">November</xsl:when>
<xsl:when test="$month=12">December</xsl:when>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:variable name="day" select="number(substring(date, 9, 2))"/>
<xsl:value-of select="$day"/>
<xsl:choose>
<xsl:when test="$day=1 or $day=21 or $day=31">st</xsl:when>
<xsl:when test="$day=2 or $day=22">nd</xsl:when>
<xsl:otherwise>th</xsl:otherwise>
</xsl:choose>
<xsl:text>, </xsl:text>
<xsl:value-of select="substring(date, 1, 4)"/>
</output>
</xsl:template>
</xsl:stylesheet>
Result
<?xml version="1.0" encoding="UTF-8"?>
<output>September 24th, 2018</output>