<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
Dear Gregory,<br>
<br>
According to [1]:<br>
> For any given event during the years from 1901 to 2099
inclusive, its date according to the Julian calendar is 13 days
behind its corresponding Gregorian date.<br>
<br>
And 13 days before 2020-01-08 is indeed 2019-12-26, which is the
360th day of the year 2019, so I am not sure about your confusion.
If you pick a date in the first 13 days of the year, then the Julian
conversion will indeed lead to a date in the year before.<br>
<br>
Maybe you are thinking about August the 1st? Your date parsing, with
month coming first, is odd for most parts of the world; the date you
are parsing in the example is the 8th of January in the year 2020.<br>
<br>
Regards,<br>
Jeroen Bransen<br>
<br>
<br>
[1] <a href="https://en.wikipedia.org/wiki/Julian_calendar">https://en.wikipedia.org/wiki/Julian_calendar</a><br>
<br>
<div class="moz-cite-prefix">Op 6-8-2020 om 05:23 schreef Gregory
Guthrie:<br>
</div>
<blockquote type="cite"
cite="mid:DM6PR03MB4331B9BAF249F1B9C5D030DBA1480@DM6PR03MB4331.namprd03.prod.outlook.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
p.src, li.src, div.src
{mso-style-name:src;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal">I dont understand why the Julian
conversion are given relative to 2019, instead of 2020, and
dont seem to actually show the date index.<o:p></o:p></p>
<p class="MsoNormal">Must be misreading the library specs?<o:p></o:p></p>
<p class="src"><a name="v:toJulianYearAndDay"
moz-do-not-send="true">toJulianYearAndDay</a> :: <a
href="https://hackage.haskell.org/package/time-1.6/docs/Data-Time-Calendar.html#t:Day"
moz-do-not-send="true">
Day</a> -> (<a
href="https://hackage.haskell.org/package/base-4.8.1.0/docs/Prelude.html#t:Integer"
moz-do-not-send="true">Integer</a>,
<a
href="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Int.html#t:Int"
moz-do-not-send="true">
Int</a>)<o:p></o:p></p>
<p> convert to proleptic Julian year and day format. First
element of result is year (proleptic Julian calendar), second
is the day of the year, with 1 for Jan 1, and 365
<o:p></o:p></p>
<p class="src"><a name="v:toJulian" moz-do-not-send="true">toJulian</a>
:: <a
href="https://hackage.haskell.org/package/time-1.6/docs/Data-Time-Calendar.html#t:Day"
moz-do-not-send="true">
Day</a> -> (<a
href="https://hackage.haskell.org/package/base-4.8.1.0/docs/Prelude.html#t:Integer"
moz-do-not-send="true">Integer</a>,
<a
href="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Int.html#t:Int"
moz-do-not-send="true">
Int</a>, <a
href="https://hackage.haskell.org/package/base-4.8.1.0/docs/Data-Int.html#t:Int"
moz-do-not-send="true">
Int</a>) <a
href="https://hackage.haskell.org/package/time-1.6/docs/src/Data-Time-Calendar-Julian.html#toJulian"
moz-do-not-send="true">
Source</a><o:p></o:p></p>
<p> convert to proleptic Julian calendar. First element of
result is year, second month number (1-12), third day (1-31).<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">----------------------------------------------------------------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">ds = "1/8/2020"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">day = parseTimeOrError True defaultTimeLocale
"%-m/%-d/%Y" ds :: UTCTime<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">getDay = toGregorian . utctDay<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">getDayOfYear = toJulian . utctDay<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">getDayYear = toJulianYearAndDay. utctDay<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">main = do<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""> print day<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""> print $ getDay day<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""> print $ getDayYear day<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""> print $ getDayOfYear day<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">2020-01-08 00:00:00 UTC<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">(2020,1,8)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">(2019,360)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">(2019,12,26)<o:p></o:p></span></p>
<p class="MsoNormal"><o:p></o:p></p>
<p class="MsoNormal">And;<o:p></o:p></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">2020-02-08 00:00:00 UTC<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">(2020,2,8)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">(2020,26)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New"">(2020,1,26)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier
New""><o:p></o:p></span></p>
<div
style="mso-element:para-border-div;border:none;border-bottom:solid
windowtext 1.0pt;padding:0in 0in 1.0pt 0in">
<p class="MsoNormal" style="border:none;padding:0in"><o:p> </o:p></p>
</div>
<p class="MsoNormal">Dr. Gregory Guthrie<o:p></o:p></p>
<p class="MsoNormal">Maharishi International University<o:p></o:p></p>
<p class="MsoNormal">----------------------------------------------------------------<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
Only members subscribed via the mailman list are allowed to post.</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Jeroen Bransen
Lead Back-end Developer at Chordify</pre>
</body>
</html>
<br>
<a href="https://chordify.net" target="_blank"><img src="https://chordify.net/img/email-signature.png"></a><br>