Last active
July 31, 2022 14:51
-
-
Save 4rass/726c90f77e0ea14b30b013dae4f69266 to your computer and use it in GitHub Desktop.
Epoch to date time and date time to epoch
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