[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: format-date() and negative (BCE) dates

Subject: Re: Re: format-date() and negative (BCE) dates
From: "Wolfgang Laun wolfgang.laun@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 7 May 2014 06:47:56 -0000
Re:  Re: format-date() and negative (BCE) dates
There is one scale of time that is free of all issues with the
counting of years around zero and local interpretations: Julian Day
Number. It is very convenient for calculating intervals of all
granularity. (You may not need Julian Day.)


On 07/05/2014, Martin Holmes gtxxgm-xsl-list-2@xxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> On 14-05-06 04:16 PM, Michael Kay mike@xxxxxxxxxxxx wrote:
>> On 6 May 2014, at 23:53, Martin Holmes gtxxgm-xsl-list-2@xxxxxxxxxxx
>> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>>> Consider this BCE date:
>>> -0001-12-29
>> This date is in fact ambiguous. In ISO 8601, and in XSD 1.1, this is
>> the date two years before 0001-12-29. In XSD 1.0, it is the date one
>> year before 0001-12-29.
> You're right. In my encoding, in fact, it's a Julian date. I'm not sure
> how to say that when passing it to the xs:date constructor. To
> complicate matters further, one of the things I'm trying to do is
> conversion between Julian and Gregorian, and it helps to do date
> arithmetic with the date functions, so I usually construct a date with
> xs:date from the Julian (which is slightly evil but still) then do the
> arithmetic to get a Gregorian date-range which is roughly equivalent.
> Most of my dates are not BCE, of course, so this oddity took me by
> surprise.
>> XPath 2.0 refers to XSD 1.0. XPath 3.0 allows the implementation to
>> use either XSD 1.0 or XSD 1.1.
>>> If I format this using the "AD" (Gregorian) calendar, like this:
>>> format-date(xs:date('-0001-12-29'), '[Y0001]-[M01]-[D01]', (),
>>> 'AD', ())
>>> I get an invalid date:
>>> 0000-12-29
>>> There is no year zero in the Gregorian calendar. I get the same
>>> results using OS (Julian). What am I doing wrong here? The ISO
>>> calendar does have a year zero. If I include the E (Era) component
>>> in the picture string, I do get "BC", but I don't see why the
>>> correct negative-one year is being changed to an incorrect
>>> zero-year.
>>> This is using Saxon 9.4 (the one distributed with Oxygen 15.2).
>> I think Saxon tries to do this according to whether or not XSD 1.1 is
>> enabled. But it's likely to be not very thoroughly tested.
>> The statement that "there is no year zero in the Gregorian calendar"
>> is inaccurate.
> I was basing my statement partly (shame) on Wikipedia", but also on the
> XSLT 2.0 spec, which says:
> "When referring to years occurring in antiquity, modern historians
> generally use a numbering system in which there is no year zero (the
> year before 1 CE is thus 1 BCE). This is the convention that should be
> used when the requested calendar is OS (Julian) or AD (Gregorian)."
>> I don't think the papal bull which is the normative
>> specification of the Gregorian calendar made any statement on the
>> matter (though I admit I haven't consulted it, and my Latin is
>> probably not good enough to make much sense of it anyway). Historians
>> generally use the Jullian calendar when referring to events prior to
>> the introduction of the Gregorian calendar. The only definitive
>> statement I know of that extends the Gregoran calendar into the past
>> is ISO 8601, and this states that there IS (or WAS) a year zero.
> The proleptic Gregorian doesn't, I agree, make much sense when it's
> extended this far back, but the project I'm working on is an early
> modern one, and most of our date-conversion functions convert between
> Julian and Gregorian. Older dates tagged as Julian also come in for the
> same conversion. You're right that it's ambiguous, though; this page:
> <http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar> shows a
> table in which 1BC Julian is equivalent to 1BC Gregorian, but it also
> appears to suggest that ISO 8601 is somehow equivalent to proleptic
> Gregorian.
> But my assumption was that if I pass a negative year into a format-date
> function telling it to use Gregorian (or Julian), I would get back the
> same negative year. I guess what's really happening is that I'm passing
> a Gregorian date into a function and it's giving me back the ISO
> equivalent. If that's what you think is happening too (i.e. it's not a
> bug in Saxon, and the zero year is what I should be getting, then I'll
> have to wrap it and trap for <=0 year off-by-one errors.
> *"Year zero does not exist in the Anno Domini system usually used to
> number years in the Gregorian calendar and in its predecessor, the
> Julian calendar." <http://en.wikipedia.org/wiki/0_%28year%29>
> Cheers,
> Martin
>> Michael Kay Saxonica

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.