ricky Posted January 17, 2012 Share Posted January 17, 2012 Hello,here is the description :#include <Date.au3>; ISO Week day number for a given date 0=Monday - 6=Sunday$iWeekday = _DateToDayOfWeekISO (@YEAR, @MON, @MDAY); NOT equal to @WdayMsgBox(4096, "", "Todays ISO WeekdayNumber is: " & $iWeekDay)The 1=Monday - 7=Sunday, what is wrong, the function or the description? Link to comment Share on other sites More sharing options...
jvanegmond Posted January 17, 2012 Share Posted January 17, 2012 (edited) expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name...........: _DateToDayOfWeek ; Description ...: Returns the weekdaynumber for a given date. ; Syntax.........: _DateToDayOfWeek($iYear, $iMonth, $iDay) ; Parameters ....: $iYear - A valid year in format YYYY ; $iMonth - A valid month in format MM ; $iDay - A valid day in format DD ; Return values .: Success - Returns Day of the Week Range is 1 to 7 where 1=Sunday. ; Failure - 0 and Set @ERROR to: ; |0 - No error. ; |1 - Invalid Input Date ; Author ........: Jos van der Zande <jdeb at="" autoitscript="" dot="" com=""> ; Modified.......: ; Remarks .......: ; Related .......: _DateToDayOfWeekISO, _DateDayOfWeek, _DayValueToDate, _DateAdd, _DateDiff ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _DateToDayOfWeek($iYear, $iMonth, $iDay) ; Verify If InputDate is valid If Not _DateIsValid($iYear & "/" & $iMonth & "/" & $iDay) Then Return SetError(1,0,"") EndIf Local $i_aFactor = Int((14 - $iMonth) / 12) Local $i_yFactor = $iYear - $i_aFactor Local $i_mFactor = $iMonth + (12 * $i_aFactor) - 2 Local $i_dFactor = Mod($iDay + $i_yFactor + Int($i_yFactor / 4) - Int($i_yFactor / 100) + Int($i_yFactor / 400) + Int((31 * $i_mFactor) / 12), 7) Return ($i_dFactor + 1) EndFunc ;==>_DateToDayOfWeek ; #FUNCTION# ==================================================================================================================== ; Name...........: _DateToDayOfWeekISO ; Description ...: Returns the ISO weekdaynumber for a given date. ; Syntax.........: _DateToDayOfWeekISO($iYear, $iMonth, $iDay) ; Parameters ....: $iYear - A valid year in format YYYY ; $iMonth - A valid month in format MM ; $iDay - A valid day in format DD ; Return values .: Success - Returns Day of the Week Range is 1 to 7 where 1=Monday. ; Failure - 0 and Set @ERROR to: ; |0 - No error. ; |1 - Invalid Input Date ; Author ........: Jos van der Zande <jdeb at="" autoitscript="" dot="" com=""> ; Modified.......: ; Remarks .......: ; Related .......: _DateToDayOfWeek, _DateDayOfWeek, _DayValueToDate, _DateAdd, _DateDiff ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _DateToDayOfWeekISO($iYear, $iMonth, $iDay) Local $idow = _DateToDayOfWeek($iYear, $iMonth, $iDay) If @error Then Return SetError(1,0,"") EndIf If $idow >= 2 Then Return $idow - 1 Return 7 EndFunc ;==>_DateToDayOfWeekISO _DateToDayOfWeek supposedly returns: Su=1, Mo=2, Tu=3, Wo=4, Thu=5, Fr=6, Sat=7 _DateToDayOfWeekISO takes the above and if result >= 2 then return subtract 1. Else return 7. Knowing the above. _DateToDayOfWeekISO should return: Su=7, Mo=1, Tu=2, Wo=3, Thu=4, Fr=5, Sat=6 The comment above the function says the same thing. In this case, I think the help is wrong. (Unless the intention was other then what was written in the function) Edited January 17, 2012 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
ricky Posted January 17, 2012 Author Share Posted January 17, 2012 Thanks, I opened it... The AutoIt Help is wrong, who is in charge to change it? Link to comment Share on other sites More sharing options...
jvanegmond Posted January 17, 2012 Share Posted January 17, 2012 There is a nice thread to easily report documentation issues here: But I would wait from a reply from Jos who originally wrote the function. Or someone else who knows what went on there. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now