CoderZone.org

Category: >> JavaScript >> Get Easter Date for any year in Javascript Bookmark and Share

<< lastnext >>

Snippet Name: Get Easter Date for any year in Javascript

Description: A great function for getting the date of Easter for any year.

Also see:
» Calculate days between any two dat...
» Write or update an htpasswd file i...
» Validate file extensions in upload...
» Easy date manipulation
» Check if a date is in the past
» Date Picker Form in ASP
» Convert Unix time string to a date...
» Copy Files By Date Modified
» Validate A URL
» Check whether a date belongs to a ...
» Get Relative Dates and Times
» Convert UK Dates To mySQL Format D...
» FUNCTIONS: date/time
» Get Date 30 days ago
» Perl SQL Update Example
» SELECT: Select For Update
» TO_DATE
» UPDATE: Update a partitioned table
» UPDATE: Update based on a record
» UPDATE: Update Object Table
» UPDATE: with RETURNING clause
» UPDATE: Nested Table Update exampl...
» UPDATE: Correlated Update
» UPDATE: Update from a SELECT state...
» UPDATE: based on multiple returned...
» UPDATE: Update based on a query
» UPDATE: Update multiple rows
» UPDATE: update a specific record
» UPDATE: Single row

Comment: (none)

Author:
Language: JAVASCRIPT
Highlight Mode: JAVASCRIPT
Last Modified: December 20th, 2010

// Example usage: var foo = Easter(2010);
 
 
function Easter(Y) {
    var C = Math.floor(Y/100);
    var N = Y - 19*Math.floor(Y/19);
    var K = Math.floor((C - 17)/25);
    var I = C - Math.floor(C/4) - Math.floor((C - K)/3) + 19*N + 15;
    I = I - 30*Math.floor((I/30));
    I = I - Math.floor(I/28)*(1 - Math.floor(I/28)*Math.floor(29/(I + 1))*Math.floor((21 - N)/11));
    var J = Y + Math.floor(Y/4) + I + 2 - C + Math.floor(C/4);
    J = J - 7*Math.floor(J/7);
    var L = I - J;
    var M = 3 + Math.floor((L + 40)/44);
    var D = L + 28 - 31*Math.floor(M/4);
 
    return padout(M) + '.' + padout(D);
}
 
function padout(number) { return (number < 10) ? '0' + number : number; }
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 10