My solution is this:
1, set a benchmark time, such as 65438+200810.7, which is Monday.
2. Accumulate the number of days from the former to the latter based on this benchmark, then divide it by 7 and multiply it by 7. If it is backward (for example, 20081October 65438+ 1), the number obtained is the number of days from the start date of the current week to the benchmark date; If it is forward (for example, June 65438+1 October1), the number obtained is the number of days of the end date of the current week relative to the benchmark date. Then just convert the number of days into the actual date according to the benchmark date.
The following function can solve your problem.
'****************************************************
* GetWeekStart *
* Get the date of the day of the week where the current date is *
* The return type is time and date *
* parameter WeekStarts is an integer variable with a value range of 0, 1 *
* 0: indicates that the first day of the week is Sunday *
* 1: indicates that the first day of the week is Monday *
'****************************************************
a=getweekstart( 1)
Response. Write (1)
Function GetWeekStart(WeekStarts)
"fuzzy start date" base date
"current time" current date
"Dim TotalDay" is the number of days between the current date and the base date.
What day is the current date?
The dim temperature starts at the weekend.
StartDay="2007- 1-29 "'Today is Monday.
NowTime = date
total day = int(Now-date value(start day))
Working days = total days mod 7
If WeekStarts=0, then
Working days = working days+1
If ... it will be over.
TempWeekStart = now-working day
GetWeekStart = year(TempWeekStart)“-”& amp; Tempweekstart "-"&; Days (temporary start)
End function
Welcome to visit my forum:)
Looking forward to your support:)