Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Discordian dates?

From: johan:forsberg:6117:student:uu:se at: 25-Jun-2001 14:52

On 25-Jun-01, Chris wrote:
> Has anyone written a REBOL function to convert Gregorian dates > to those used by the Paratheo-anametamystikhood of Eris Esoteric (or > PPOE if you prefer) yet? I think "Sweetmorn, the 30th day of > Confusion in the YOLD 3167" sounds so much better than Mon Jun 25 > 2001 ;)
Well, I had been thinking about doing it, bot not gotten around to it. Here's the first version of my %ddate.r. It's almost untested, I just threw a few dates at it and they came out OK. Please don't trust it for anything very important as I may have messed something up :) -- Johan Forsberg -- Attached file included as plaintext by Listar -- -- File: ddate.r REBOL [ title: "Discordian dates" version: 0.0.1 author: "Johan Forsberg" file: %ddate.r email: [johan--forsberg--6117--student--uu--se] date: 25-june-2001 ddate: "Sweetmorn, Confusion 30, Year of Our Lady of Discord 3167" purpose: {Date Converter from the Gregorian to the Semi-Divinely Revealed POEE Calendar.} example: {poee-calendar/make-poee-date-string now} ] poee-calendar: context [ seasons: ["Chaos" "Discord" "Confusion" "Bureaucracy" "The Aftermath"] weekdays: ["Sweetmorn" "Boomtime" "Pungenday" "Prickle" "Setting Orange"] holidays: [ apostle ["Mungoday" "Mojoday" "Syaday" "Zaraday" "Maladay"] season ["Chaoflux" "Discoflux" "Confuflux" "Bureflux" "Afflux"] ] leap-year?: function [year] [] [ return either ((year // 4) = 0) and ((year // 400) = 0) [true] [false] ] get-day-of-year: function [date] [day] [ gregorian: [ 31 (either leap-year? date/year [29] [28]) 31 30 31 30 31 31 30 31 30 31 ] day: date/day for i 1 (date/month - 1) 1 [ day: day + do gregorian/:i ] return day ] get-season-and-day: function [date] [day season] [ day: get-day-of-year date season: 1 while [day > 73] [ day: day - either (season = 1) and (leap-year? date/year) [74] [73] season: season + 1 ] return reduce [season day] ] make-poee-date: function [date] [sd wd] [ sd: get-season-and-day date wd: (get-day-of-year date) // 5 return compose [ weekday (pick weekdays wd) season (pick seasons sd/1) day (sd/2) year (date/year + 1166) holiday ( switch/default sd/2 [ 5 [pick holidays/apostle sd/1] 50 [pick holidays/season sd/1] ] [none] ) ] ] make-poee-date-string: function [date] [pd] [ pd: make-poee-date date return rejoin [ pd/weekday ", " pd/season " " pd/day ", Year of Our Lady of Discord " pd/year either none? pd/holiday [""] [rejoin [" -- " pd/holiday]] ] ] ]