简体   繁体   中英

How to find the start date of week from a given date?

I have a concern is that I want from a given date to retrieve the start date of the week for example: 15/04/2015 So the beginning of the week will: 13/04/2015 (for me the beginning of the week is Monday).

thanks

Try this :-)

Dim FirstDayInWeek, LastDayInWeek  As Variant
Dim dtmDate As Date
dtmDate = "15/04/2015"

The begin date of week:

FirstDayInWeek = dtmDate - Weekday(dtmDate, vbUseSystem) + 1
MsgBox FirstDayInWeek

The end date of Week

LastDayInWeek = dtmDate - Weekday(dtmDate, vbUseSystem) + 7
MsgBox LastDayInWeek

Try this Formula:-

=A1-WEEKDAY(A1,2)+1

Where A1 contains your Input Date.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM