本文介绍了如何从给定日期查找周的开始日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个担心是,我想从一个给定的日期检索一周的开始日期,例如:15/04/2015所以本周的开始将:13/04/2015(对我来说这个星期是星期一)。

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).

谢谢

推荐答案

- )

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

开始日期od week:

The begin date od week:

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

结束日期

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

这篇关于如何从给定日期查找周的开始日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 23:11