Jump to content
Sign in to follow this  
sensalim

Variable holiday-- how to code?

Recommended Posts

sensalim

Say thanksgiving (last thu of nov)... how do you code that?

Help ;)

Thanks!

Share this post


Link to post
Share on other sites
dbzfanatic
system24

I think you mean how to save dates in AutoIt.


[center]It's a question of mind over matter, if I don't mind, it doesn't matter.[/center]

Share this post


Link to post
Share on other sites
rover

@sensalim

This will give you a start.

If I'm missing something here, its 5am where I am ;)

Say thanksgiving (last thu of nov)... how do you code that?

Edit: American Thanksgiving is the 4th Thursday in November, not the last Thursday.

use the code below this box.

#include <Date.au3>
; get date of Thanksgiving USA for current year (last Thursday of November)
For $i = 0 To 6
    $ThanksgivingDate = 30 - $i
    If _DateToDayOfWeek(@YEAR, 11, $ThanksgivingDate) = 5 Then ExitLoop
Next
MsgBox( 4096, "", "Thanksgiving USA is:" & @CRLF &  "Nov " & $ThanksgivingDate & ", " & @YEAR)
ConsoleWrite("+Thanksgiving USA " & @YEAR & " is: Nov " & $ThanksgivingDate & @CRLF & @CRLF)

; runs if date is Thanksgiving USA
If Number(@MON) = 11 And Number(@WDAY) = 5 And (30 - Number(@MDAY)) < 7 Then
    MsgBox( 4096, "", "Today is Thanksgiving USA " & @CRLF & "Nov " & @MDAY & ", "
Edited by rover

I see fascists...

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  

×