<?php
/*
Author: Niall Sheridan
Email: ns@niallsheridan.com
Date: 61 Discord 3168
Purpose:
Converts the current date to its Discordian equivalent.
Much like the ddate program on *nix systems.
Except that there's no date formatting.
And it only does the current date.
License: GPL
*/
function ddate() {
$season_list=array(»Chaos«, »Discord«, »Confusion«, »Bureaucracy«, »The Aftermath«);
$day_list=array(»Sweetmorn«, »Boomtime«, »Pungenday«, »Prickle-Prickle«, »Setting Orange«);
$a_holiday=array(»Mungday«, »Mojoday«, »Syaday«, »Zaraday«, »Maladay«); // Apostle holidays. Occur on 5th of every season.
$s_holiday=array(»Chaoflux«, »Discoflux«, »Confuflux«, »Bureflux«, »Afflux«); // Seasonal holidays. Occur on 50th of every season
$now=getdate();
$dyear=$now[»year«]+1166;
$yday=$now[»yday«];
$mon=$now[»mon«];
$mday=$now[»mday«];
$dseason=(int)($yday/73);
$name_season=$season_list[$dseason];
$dday=($yday-(73*$dseason))+1;
$fizz=$dday%10;
switch ($fizz) {
case 1:
$dday.=»st«;
break;
case 2:
$dday.=»nd«;
break;
case 3:
$dday.=»rd«;
break;
default:
$dday.=»th«;
}
$dweekday=$day_list[($yday%5)];
$ddate=$dweekday.», «.$dday.» «.$name_season.», «.$dyear.».«;
if ($dday==5) {
$ddate.=» Celebrate «.$a_holiday[$dseason].».«;
} elseif ($dday==50) {
$ddate.=» Celebrate «.$s_holiday[$dseason].».«;
} elseif ($mon==2 && $mday==29) {
$ddate=»Celebrate St. Tib's Day!«; //Hurrah!
}
echo $ddate;
}
?>
|