Jump to content

CountDiffDays


SlimShady
 Share

Recommended Posts

Hi,

I was trying to count how many days until, for instance, the next tuesday.

I remembered JdeB had a collection of new date functions.

Available http://www.autoitscript.com/fileman/users/jdeb/test/datenew.au3.

So, I was checking all the functions to see if there was a function like that.

Took me a while...

And then I made one. I'm a little tired now;

Can you test the function I made to see if it works correct?

Share your thoughts here...

;----- This part is an example-----
$ToDay = 5
$NextDay = 3
$Diff = CountDiffDay($ToDay, $NextDay)
MsgBox(0, "Test", "Difference in days: " & $Diff)
Exit
;------------ End of example------

Func CountDiffDay($Day1, $Day2)
    If $Day1 = $Day2 Then
        $Count = 0
    Else
        If $Day2 > $Day1 Then
            $Count = $Day2 - $Day1
        Else
            $First = 7 - $Day1
            $Count = $First + $Day2
        EndIf
    EndIf
    Return $Count
EndFunc
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...