

Task

Convert a given date from the   Gregorian calendar   to the   Discordian calendar.




      INSTALL @lib$+"DATELIB"
 
      PRINT "01/01/2011 -> " FNdiscordian("01/01/2011")
      PRINT "05/01/2011 -> " FNdiscordian("05/01/2011")
      PRINT "28/02/2011 -> " FNdiscordian("28/02/2011")
      PRINT "01/03/2011 -> " FNdiscordian("01/03/2011")
      PRINT "22/07/2011 -> " FNdiscordian("22/07/2011")
      PRINT "31/12/2011 -> " FNdiscordian("31/12/2011")
 
      PRINT "01/01/2012 -> " FNdiscordian("01/01/2012")
      PRINT "05/01/2012 -> " FNdiscordian("05/01/2012")
      PRINT "28/02/2012 -> " FNdiscordian("28/02/2012")
      PRINT "29/02/2012 -> " FNdiscordian("29/02/2012")
      PRINT "01/03/2012 -> " FNdiscordian("01/03/2012")
      PRINT "22/07/2012 -> " FNdiscordian("22/07/2012")
      PRINT "31/12/2012 -> " FNdiscordian("31/12/2012")
      END
 
      DEF FNdiscordian(date$)
      LOCAL Season$(), Weekday$(), mjd%, year%, day%
      DIM Season$(4), Weekday$(4)
      Season$() =  "Chaos", "Discord", "Confusion", "Bureaucracy", "The Aftermath"
      Weekday$() = "Sweetmorn", "Boomtime", "Pungenday", "Prickle-Prickle", "Setting Orange"
 
      mjd% = FN_readdate(date$, "dmy", 2000)
      year% = FN_year(mjd%)
 
      IF FN_month(mjd%)=2 AND FN_day(mjd%)=29 THEN
        = "St. Tib's Day, YOLD " + STR$(year% + 1166)
      ENDIF
 
      IF FN_month(mjd%) < 3 THEN
        day% = mjd% - FN_mjd(1, 1, year%)
      ELSE
        day% = mjd% - FN_mjd(1, 3, year%) + 59
      ENDIF
      = Weekday$(day% MOD 5) + ", " + STR$(day% MOD 73 + 1) + " " + \
      \ Season$(day% DIV 73) + ", YOLD " + STR$(year% + 1166)