Jump to content

Testing that a specific day of the month has passed?


 Share

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

Link to comment
Share on other sites

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

#include <date.au3>
$daytocheck=05 ; Friday
$count=0
For $i=1 To @mday
    If _DateToDayOfWeekIso(@year,@mon,$i)=$daytocheck-1 Then
        $count+=1
    EndIf
Next
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!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...