Jump to content
Sign in to follow this  

Testing that a specific day of the month has passed?

Recommended Posts

I need to determine if a specific day has passed already this year. e.g. Last Sunday in March

How can I do that?

Here are some more of examples of what I want to evaluate:

Last Sunday in March

Last Sunday in October

First Sunday in April

second Sunday in March

first Sunday in November

Share this post

Link to post
Share on other sites

Here's me idea, although I think there is a more clever way:

#include <date.au3>
$daytocheck=05 ; Friday
For $i=1 To @mday
    If _DateToDayOfWeekIso(@year,@mon,$i)=$daytocheck-1 Then
MsgBox(0,"Result:","There has been "&$count&" fridays this month")

Edit: So if you want to check againt it, just do: If $count>=1 Then ; First friday of current month has passed

Edited by monoceres

Broken link? PM me and I'll send you the file!

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  

  • Create New...