PDA

View Full Version : Playing around with the easter month on your calendar.



rainarts
07-25-2008, 04:15 PM
This a bit skeptic if you don't know how it works for you! Here's how we handle it... The so called easter month problem.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Prototyping</title>
</head>
<body>
<script type="text/javascript">
<!--Hiding
var today = new Date();
var month = today.getMonth();
var date = today.getDate();
var year = today.getFullYear();
var a = year % 19;
var b = Math.floor(year/100);
var c = year % 100;
var d = Math.floor(b/4);
var e = b % 4;
var f = Math.floor((b+8) / 25);
var g = Math.floor((b-f+1) / 3);
var h = (19*a + b - d - g + 15) % 30;
var i = Math.floor(c/4);
var j = c % 4;
var k = (32 + 2*e + 2*i - h - j) % 7;
var m = Math.floor((a + 11*h + 22*k) / 451);
var easterMonth = Math.floor((h + k -7*m + 114) / 31);
var easterDate = ((h + k - 7*m +114) % 31) + 1;
easterMonth = easterMonth-1;

if (( month == easterMonth ) && ( date == easterDate ));
document.write('Easter Sunday');
// Done Hiding -->
</script>
</body>
</html>
Tell me if find any problem with this code... Tnx