Created
November 12, 2013 14:18
-
-
Save nachoplaza/7431549 to your computer and use it in GitHub Desktop.
Functions for XSLT conversion between dateTime format and Epoch format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:call-template name="dateTimeToEpoch"> | |
<xsl:with-param name="dateTimeValue" select="$value"/> | |
</xsl:call-template> | |
<xsl:template name="dateTimeToEpoch"> | |
<xsl:param name="dateTimeValue"/> | |
<xsl:value-of select="( dateTime($dateTimeValue) - xsd:dateTime('1970-01-01T00:00:00') ) div xsd:dayTimeDuration('PT1S')"/> | |
</xsl:template> | |
<xsl:template name="epochToDateTime"> | |
<xsl:param name="epochTime"/> | |
<xsl:value-of select="xsd:dateTime('1970-01-01T00:00:00') + ($epochTime * xsd:dayTimeDuration('PT1S'))"/> | |
</xsl:template> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment