A版迅速
#include <date.au3>
Local $day = '20200101'
Local $sGetDay = _GetDay($day)
If Not @error Then MsgBox(0,0,$sGetDay)
Func _GetDay($day)
Local $aReg = StringRegExp($day, '(\d{4})(\d\d)(\d\d)', 1)
If @error Then Return SetError(1, 0, '')
For $i = 1 To 3
Local $sRet = _DateAdd('D', -$i, $aReg[0] & '/' & $aReg[1] & '/' & $aReg[2])
If @error Then ContinueLoop
Local $aRet = StringRegExp($sRet, '\d+', 3)
If @error Then ContinueLoop
Local $sWeekDay = _DateToDayOfWeek($aRet[0], $aRet[1], $aRet[2])
If $sWeekDay > 1 And $sWeekDay < 7 Then Return $aRet[0] & $aRet[1] & $aRet[2]
Next
Return SetError(2, 0, '')
EndFunc ;==>_GetDay
|