Discordian date: Difference between revisions

m
→‎{{header|AppleScript}}: Tidied opening block comment.
(Add MAD)
m (→‎{{header|AppleScript}}: Tidied opening block comment.)
Line 699:
 
<lang applescript>on gregorianToDiscordian(inputDate) -- Input: AppleScript date object.
(* Rules:
Discordian weeksyears haveare fivealigned days eachwith, and always start at the beginning of the year. There are seventy-three in a year. (73same *length 5as, =Gregorian 365years.)
DiscordianEach seasonshas have73 seventy5-threeday daysweeks each.and There5 are73-day fiveseasons. of(73 them* in5 a= year365.)
The first day of a Discordian year is also that of its first week and first season.
In leap years, an extra day called "St. Tib's Day" is inserted between days 59 and 60, the same slot as the Gregorian 29th February. It's considered to be outside the Discordian week and season, so the day after it is Setting Orange, Chaos 60, not Sweetmorn, Chaos 61. Discordian dates always correspond to particular Gregorian dates.
In leap years, an extra day called "St. Tib's Day", is inserted between days 59 and 60.
Year 1 YOLD is 1166 BC.
It's considered to be outside the calendar, so the day after it is Setting Orange, Chaos 60,
This handler is only guaranteed for AD Gregorian dates and it's the calling process's responsibility to convert any user text input from the user's format to an AS date object.
Sincenot theSweetmorn, DiscordianChaos calendar61. Year 1 YOLD is an American1166 inventionBC, but this handler's outputtakes isan inAS thedate US style: "Weekday, Season day, year".object
as its input and is only good for AD Gregorian dates. Since the Discordian calendar's an
American invention, the output here's in the US style: "Weekday, Season day, year".
*)
-- Calculate the input date's day-of-year number.
copy inputDate to startOfYear
Line 741 ⟶ 742:
end gregorianToDiscordian
 
set gregorianDateASDate to (current date)'s date string
set ASDategregorianDate to ASDate's date gregorianDatestring
set discordianDate to gregorianToDiscordian(ASDate)
return {Gregorian:gregorianDate, Discordian:discordianDate}</lang>
 
{{output}}
<prelang applescript>{Gregorian:"TuesdaySaturday 255 FebruaryDecember 2020", Discordian:"SweetmornPrickle-Prickle, ChaosThe Aftermath 5647, 3186"}</prelang>
 
=={{header|AWK}}==
557

edits