xyold1 发表于 2010-8-2 19:14:32

[已解决]有没有计算时间间隔的函数?

本帖最后由 xyold1 于 2010-8-3 11:09 编辑

我要算2004年2月5日15时20分30秒与2010年5月1日20分40秒,之间相差了多少年多少月多少日多少小时分秒,请问有没有计算这种时间的UDF?

afan 发表于 2010-8-2 19:20:58

_DateDiff()

xyold1 发表于 2010-8-2 19:28:03

谢谢,我去看看

xyold1 发表于 2010-8-2 19:31:20

_DateDiff
--------------------------------------------------------------------------------

Returns the difference between 2 dates, expressed in the type requested


#Include <Date.au3>
_DateDiff($sType, $sStartDate, $sEndDate)




Parameters

$sType One of the following:
D = Difference in days between the given dates
M = Difference in months between the given dates
Y = Difference in years between the given dates
w = Difference in Weeks between the given dates
h = Difference in hours between the given dates
n = Difference in minutes between the given dates
s = Difference in seconds between the given dates
$sStartDate Input Start date in the format "YYYY/MM/DD[ HH:MM:SS]"
$sEndDate Input End date in the format "YYYY/MM/DD[ HH:MM:SS]"



Return Value

Success: Difference between the 2 dates.
Failure: Returns 0 and set @error
@error: 0 - No error
1 - Invalid $sType
2 - Invalid $sStartDate
3 - Invalid $sEndDate


还行吧
页: [1]
查看完整版本: [已解决]有没有计算时间间隔的函数?