Jump to content

Help on Datediff minus the weekend


lolipop
 Share

Go to solution Solved by GaRydelaMer,

Recommended Posts

  • Solution

Hi

i've made this function:

#include <Date.au3>

ConsoleWrite(_JoursOuvres("2014/01/01", "2014/01/08") & @LF)

;; Return 6

Func _JoursOuvres($Start_Date, $End_Date)
    Local $DT = $Start_Date, $iCount = 0, $Y, $M, $D
    While $DT <= $End_Date
        $Y = StringRegExpReplace($DT, "(\d+)/.*", "$1")
        $M = StringRegExpReplace($DT, ".*/(\d+)/.*", "$1")
        $D = StringRegExpReplace($DT, ".*/(\d+)", "$1")
        If _DateToDayOfWeek($Y, $M, $D) <> 1 And _DateToDayOfWeek($Y, $M, $D) <> 7 Then
            $iCount += 1
        EndIf
        $DT = _DateAdd("D", 1, $DT)
    WEnd
    Return $iCount
EndFunc

Edit spelling

Edited by GaRydelaMer
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...