;处理一下 _DateDiff() 的 结果.........
;一年按366天算,一个月按31天算
;等楼下进步一修正吧
#Include <Date.au3>
MsgBox(0, "", DateDiffStr("2012/2/25", "2013/3/2"))
Func DateDiffStr($sStartDate, $sEndDate)
$str = ""
$years = ""
$month = ""
$d = ""
$days = _DateDiff('D', $sStartDate, $sEndDate)
If $days > 30 Then
If $days > 366 Then
$years = Floor($days/366)
$days = Mod($days, 366)
$month = Floor($days/31)
$d = Mod($days, 31)
$str = $years & "年" & $month & "月" & $d & "天"
Else
$month = Floor($days/31)
$d = Mod($days, 31)
$str = $month & "月" & $d & "天"
EndIf
Else
$str = $days & "天"
EndIf
Return $str
EndFunc
|