JohnOne Posted February 11, 2014 Posted February 11, 2014 (edited) When is the next pancake Tuesday? expandcollapse popup#include <Date.au3> $YAY = _PancakeTuesday() MsgBox(0, "Pancake Teusday", $YAY) ;year/month/day Func _PancakeTuesday() For $iYe = @YEAR To @YEAR + 1 For $iMon = 3 To 4 For $iDa = 1 To 31 If $iMon <> 4 And $iMon <> 3 Then ContinueLoop 2 If $iMon = 3 And $iDa < 22 Then ContinueLoop If _IsEasterSunday($iDa, $iMon, $iYe) Then $tmp = _DateAdd('w', -6, $iYe & "/" & $iMon & "/" & $iDa) $PancakeTuesday = _DateAdd('D', -5, $tmp) Return $PancakeTuesday EndIf Next Next Next EndFunc ;==>_PancakeTuesday Func _IsEasterSunday($iday, $imonth, $iyear) ;http://www.autoitscript.com/forum/topic/120126-iseastersunday/#entry834668 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 ;==>_IsEasterSunday Edited February 15, 2014 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
DatMCEyeBall Posted February 11, 2014 Posted February 11, 2014 (edited) MsgBox(0, "Pancake Tuesday", $YAY) ;year/month/day It's a typo. Edited February 11, 2014 by DatMCEyeBall "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation
czardas Posted February 12, 2014 Posted February 12, 2014 Awesome, I love pancakes. This is just the kind of script I need to combine with _LochNessMonsterCase() to make a UDF for ages 5 and upwards. operator64 ArrayWorkshop
JohnOne Posted February 13, 2014 Author Posted February 13, 2014 MsgBox(0, "Pancake Tuesday", $YAY) ;year/month/day It's a typo. Yes. not important though. Awesome, I love pancakes. This is just the kind of script I need to combine with _LochNessMonsterCase() to make a UDF for ages 5 and upwards. Me too, roll on nom nom czardas 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
TechCoder Posted February 13, 2014 Posted February 13, 2014 For those, like me, that got excited about Pancakes, but didn't know there was a special day........ http://en.wikipedia.org/wiki/Shrove_Tuesday
czardas Posted February 15, 2014 Posted February 15, 2014 Yes. not important though. Me too, roll on nom nom Maybe you should make a feature request. Add it to Date.au3. operator64 ArrayWorkshop
JohnOne Posted February 15, 2014 Author Posted February 15, 2014 haha. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted February 15, 2014 Author Posted February 15, 2014 (edited) A lot of these days can be calculated via Easter it seems. Mothers Day (Mothering Sunday - UK) expandcollapse popup#include <Date.au3> $YAY = _MothersDay() MsgBox(0, "Mothers Day", $YAY) ;year/month/day Func _MothersDay() For $iYe = @YEAR To @YEAR + 1 For $iMon = 3 To 4 For $iDa = 1 To 31 If _IsEasterSunday($iDa, $iMon, $iYe) Then $mothersDay = _DateAdd('w', -3, $iYe & "/" & $iMon & "/" & $iDa) Return $mothersDay EndIf Next Next Next EndFunc ;==>_MothersDay Func _IsEasterSunday($iday, $imonth, $iyear) ;http://www.autoitscript.com/forum/topic/120126-iseastersunday/#entry834668 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 ;==>_IsEasterSunday Edited February 15, 2014 by JohnOne czardas 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
JohnOne Posted February 15, 2014 Author Posted February 15, 2014 Moms Day US is a little easier. #include <Date.au3> $YAY = _MothersDayUSA() MsgBox(0, "Mothers Day USA", $YAY) ;year/month/day Func _MothersDayUSA() For $iYe = @YEAR + 2 To @YEAR + 3 $iMon = 5 For $iDa = 1 To 30 $DateToDayOfWeek = _DateToDayOfWeek($iYe, $iMon, $iDa) If _DateDayOfWeek($DateToDayOfWeek) == "Sunday" Then $mothersDayUSA = _DateAdd('w', 1, $iYe & "/" & $iMon & "/" & $iDa) Return $mothersDayUSA EndIf Next Next EndFunc ;==>_MothersDayUSA AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now