Jump to content
Sign in to follow this  
JohnOne

_IsEasterSunday()

Recommended Posts

JohnOne

You how you always need to check if its easter sunday on a certain date in a couple of years.

ConsoleWrite(_IsEasterSunday(31,3,2013) & @LF); d m yyyy

Func _IsEasterSunday($iday, $imonth, $iyear)

    If $iyear < 1 Or $iyear > 9999 Then
        Return False
        Exit
    EndIf

    $a = Mod($iyear, 19)
    $b = Mod($iyear, 4)
    $c = Mod($iyear, 7)
    $d = Mod(19 * $a + 24, 30)
    $e = Mod(2 * $b + 4 * $c + 6 * $d + 5, 7)
    $sunday = 22 + $d + $e
    $month = 3

    If $sunday > 31 Then
        $month = 4
        $sunday -= 31
    EndIf

    If $iday = $sunday And $imonth = $month Then
        Return True
    Else
        Return False
    EndIf

EndFunc

Sorry ;) I couldnt find on on the forum.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
JohnOne

Dont know how I missed that, I probaby searched eastersunday ;)

Someone sent the formula over a chat window, (riveting stuff it was)

Dosent mothers day (UK) change too? I wonder if theres a formula for that.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
czardas

I find it quite annoying when all these dates keep changing. Didn't they try and change St. Patricks day a year ago. I suppose it's one of those social phenomenons. Still it would be useful to have a varied library of international public holiday dates. It would be pretty useful for international stuff.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.