如何从给定的datefind星期的开始date?
我有一个担心的是,我想从一个给定的date检索一周的开始date,例如:15/04/2015因此,一周的开始将是:13/04/2015(对于我来说,本周的开始是星期一)。
谢谢
尝试这个 :-)
Dim FirstDayInWeek, LastDayInWeek As Variant Dim dtmDate As Date dtmDate = "15/04/2015"
od周的开始date:
FirstDayInWeek = dtmDate - Weekday(dtmDate, vbUseSystem) + 1 MsgBox FirstDayInWeek
周的结束date
LastDayInWeek = dtmDate - Weekday(dtmDate, vbUseSystem) + 7 MsgBox LastDayInWeek
试试这个公式:
=A1-WEEKDAY(A1,2)+1
A1包含您的inputdate。