XSLT: Timestamp to epoch v1.0 vs v2.0 -
to convert timestamp epoch in xslt, there suggested method both v1.0 , v2.0 each:
//v2.0 <xsl:value-of select="round((xs:datetime('2017-08-03t19:20:39.096z') - xs:datetime('1970-01-01t00:00:00')) div xs:daytimeduration('pt1s'))"/>
and
//v1.0 <xsl:template name="date-to-unixtime"> <xsl:param name="date"/> <xsl:variable name="year" select="substring($date, 1, 4)"/> <xsl:variable name="month" select="substring($date, 6, 2)"/> <xsl:variable name="day" select="substring($date, 9, 2)"/> <xsl:variable name="a" select="floor((14 - $month) div 12)"/> <xsl:variable name="y" select="$year + 4800 - $a"/> <xsl:variable name="m" select="$month + 12*$a - 3"/> <xsl:variable name="d" select="$day + floor((153*$m + 2) div 5) + 365*$y + floor($y div 4) - floor($y div 100) + floor($y div 400) - 2472633"/> <xsl:value-of select="round(86400*$d)" /> </xsl:template> <xsl:call-template name="date-to-unixtime"><xsl:with-param name="date" select="'2017-08-03t19:20:39.096z'" /></xsl:call-template> </what></xsl:for-each>
my question is, results of both have difference of 1 min 10 sec. reason be? there way ensure match? interested in because restricted use v1.0. thanks
Comments
Post a Comment