【发布时间】:2015-06-25 02:01:29
【问题描述】:
我发现了很多函数来确定特定日期是一年中的哪一天:
Function Yearday(dat As Date) As Integer
'Purpose: does the same as day for month
'Use to access an array where the index corresponds to days
Yearday = DateDiff("d", CDate("1/1/" & Year(dat)), dat) + 1
End Function
但我还没有找到任何函数来根据特定年份的某天确定日期。
函数签名如下所示:
Function getDateBasedOnYearAndDayOfYear(year As Integer, dayOfYear As Integer) AS Date
【问题讨论】:
-
公式 "=DATE(year,1,dayOfYear)" 会起作用,除非我没有正确理解这个问题。这是在单元格中,因此您需要将其转换为适当的 VBA 宏
标签: excel vba date ms-access-2007