|
Pacific Database |
|
| Home Company Services Employment Support Centre Events Contact Us | |
|
A world of information at your fingertips |
|
Date & Time :: Week functionsOn this page you will find several functions for calculating week-related dates. Week of the month myInt = DatePart("w", dte)
myInt = Format(dte, "w")
Week of the year myInt = DatePart("ww", dte)
myInt = Format(dte, "ww")
Monday in a specified week Public Function GetMondayOfWeek(iWeekNo As Integer) As Date
Dim tmpDate As Date
tmpDate = DateAdd("ww", iWeekNo, DateSerial(Year(Date), 1, 1))
GetMondayOfWeek = tmpDate - (Weekday(tmpDate, vbMonday) - 1)
End Function
First day of a specified week (Monday = day 1) myDate = dte - Weekday(dte, vbMonday) + 1
myDate = dateadd("d",1-weekday(dte,vbMonday),dte)
Last day of a specified week (Monday = day 1) myDate = dte + (7 - Weekday(dte, vbMonday))
myDate = dateadd("d",7-weekday(dte,vbMonday),dte)
First day of next week (Monday is day 1)myDate = dte + (7 - Weekday(dte, vbMonday)) + 1 Last day of next week (Monday = day 1)myDate = dte + (7 - Weekday(dte, vbMonday)) + 7 First day of previous week (Monday = day 1)myDate = (dte - Weekday(dte, vbMonday) + 1) - 7 Last day of previous week (Monday = day 1) myDate = dte - Weekday(dte, vbMonday)
|
Tested on...
|
| Home • Company • Services • Employment • Support Centre • Events • Contact Us | Pacific Database © 2008 |