Skip to content

Instantly share code, notes, and snippets.

@weipah
Created March 27, 2012 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weipah/2213734 to your computer and use it in GitHub Desktop.
Save weipah/2213734 to your computer and use it in GitHub Desktop.
Wochenstart und -Ende anhand eines Datums bestimmen (Access VBA, Array)
' Aufruf
Dim tage() As String
tage = getWeek(textbox.text)
Function getWeek(datum As String) As Variant
'Dim datum As String
Dim result(1) As String
Dim wochentag As Integer
Dim wStart As String
Dim wEnde As String
wochentag = Weekday(datum, vbMonday)
wStart = DateAdd("d", (wochentag - 1) * -1, datum)
wEnde = DateAdd("d", 7 - wochentag, datum)
result(0) = wStart
result(1) = wEnde
getWeek = result
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment