本帖最后由 xms77 于 2013-9-19 22:37 编辑
回复 1# scorpio1102
笨办法就是凑日子来算,呵呵!
#include <Date.au3>
Local $Date = _Date_Countday2Date(2012366)
MsgBox(0, 0, $Date)
Func _Date_Countday2Date($iCountDay)
Local $Month[12] = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
Local $MDay[31] = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"]
If Not StringRegExp($iCountDay, "\d+", 0) Then Return MsgBox(16, "Error", '数据无效')
Local $Year = StringLeft($iCountDay, 4)
Local $CountDay = Int(StringTrimLeft($iCountDay, 4))
If $CountDay > 366 Then Return MsgBox(16, "Error", '数据无效')
For $i = 0 To 11
For $j = 0 To 30
If _DateDiff('D', $Year & "/01/01", $Year & "/" & $Month[$i] & "/" & $MDay[$j]) = $CountDay-1 Then
Return $Year & $Month[$i] & $MDay[$j]
EndIf
Next
Next
EndFunc ;==>_Date_Countday2Date
|