Calculating Julian and Absolute Day Numbers from a Specified Date
Problem
You have a date and would like to know the corresponding Julian day number and/or Absolute day number.
Solution
This template will give you the Julian day, given the year, month, and day:
<xsl:template name="date:calculate-julian-day"> <xsl:param name="year"/> <xsl:param name="month"/> <xsl:param name="day"/> <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:value-of select="$day + floor((153 * $m + 2) div 5) + $y * 365 + floor($y div 4) - ...
Get XSLT Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.