Hi there, I'm trying to find a way to ensure a date is in a specific format, however I'm struggling. I want it to be in the format yyyy-mm-dd hh:mm:ss, and if it's not in that format I want to output something generic (for instance, 2000-01-01 00:00:00). I'm trying to do this using xslt. This is my current code, which is just an example I'm using to figure it out:
<xsl:variable name="varfulldate"><xsl:value-of select="fulldate"/></xsl:variable>
<xsl:choose>
<xsl:when test='$varfulldate=2'>
<td><xsl:value-of select="fulldate"/></td>
</xsl:when>
<xsl
therwise>
<td>2000-01-01 00:00:00</td>
</xsl
therwise>
</xsl:choose>
This works, however I obvoiusly don't want to test if it's equal to '2'. I want to somehow test to ensure it's in the proper format, and if not I want to through the whole value away and use 2000-01-01 00:00:00. Does anyone know how to do this?
<xsl:variable name="varfulldate"><xsl:value-of select="fulldate"/></xsl:variable>
<xsl:choose>
<xsl:when test='$varfulldate=2'>
<td><xsl:value-of select="fulldate"/></td>
</xsl:when>
<xsl
<td>2000-01-01 00:00:00</td>
</xsl
</xsl:choose>
This works, however I obvoiusly don't want to test if it's equal to '2'. I want to somehow test to ensure it's in the proper format, and if not I want to through the whole value away and use 2000-01-01 00:00:00. Does anyone know how to do this?