Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Dim dt1 As Date dt1 = Date MsgBox dt1 ' works - 12.10.2012 Day(dt1) = 1 ' error: object required
我需要 1.10.2012 因此,对于任何日期,我都需要将 dt1 设置为该特定日期的第一天。
您可以使用日期序列来重建日期
例如
newDate = DateSerial(Year(dt1), Month(dt1), 1)
也可以直接扣除天数
dt1 = dt1 - Day(dt1) + 1