Converts today's date to it's Discordian equivalent.
By : niall
<?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; } ?>
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.