Pancake Tuesday + Mothers Day

Recommended Posts

When is the next pancake Tuesday?

```#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 by JohnOne

Monkey's are, like, natures humans.

Share on other sites

`MsgBox(0, "Pancake Tuesday", \$YAY) ;year/month/day`

It's a typo.

Edited 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

Share on other sites

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.

Share on other sites
`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

• 1

Monkey's are, like, natures humans.

Share on other sites

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

Share on other sites

Yes. not important though.

Me too, roll on nom nom

Maybe you should make a feature request. Add it to Date.au3.

Share on other sites

haha.

Monkey's are, like, natures humans.

Share on other sites

A lot of these days can be calculated via Easter it seems.

Mothers Day (Mothering Sunday - UK)

```#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 by JohnOne
• 1

Monkey's are, like, natures humans.

Share on other sites

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```

Monkey's are, like, natures humans.

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