Sign in to follow this  
Followers 0

CountDiffDays

1 post in this topic

#1 ·  Posted

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

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  
Followers 0