AH, yes – thanks, that is the missing 13-days mystery?

And yes – in us MM/dd/yy is most common.

Thanks.

 

 

Dr. Gregory Guthrie

Maharishi International University

----------------------------------------------------------------

 

Subject: Re: [Haskell-cafe] dates...

 

Dear Gregory,

According to [1]:
> 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.


Regards,
Jeroen Bransen


[1] https://en.wikipedia.org/wiki/Julian_calendar

Op 6-8-2020 om 05:23 schreef Gregory Guthrie:

I don’t understand why the Julian conversion are given relative to 2019, instead of 2020, and don’t seem to actually show the date index.

Must be misreading the library specs?

toJulianYearAndDay :: Day -> (Integer, Int)

     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

toJulian :: Day -> (Integer, Int, Int) Source

    convert to proleptic Julian calendar. First element of result is year, second month number (1-12), third day (1-31).

----------------------------------------------------------------------------------

 

ds = "1/8/2020"

day = parseTimeOrError True defaultTimeLocale "%-m/%-d/%Y"   ds :: UTCTime

 

getDay       = toGregorian       . utctDay

getDayOfYear = toJulian          . utctDay

getDayYear   = toJulianYearAndDay. utctDay

 

main = do

      print day

      print $ getDay       day

      print $ getDayYear   day

      print $ getDayOfYear day

 

2020-01-08 00:00:00 UTC

(2020,1,8)

(2019,360)

(2019,12,26)

And;

2020-02-08 00:00:00 UTC

(2020,2,8)

(2020,26)

(2020,1,26)

 

Dr. Gregory Guthrie

Maharishi International University

----------------------------------------------------------------

 

 

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.

 

-- 
Jeroen Bransen
Lead Back-end Developer at Chordify