Page History: Quick Day Of Week (and tiny too)
Compare Page Revisions
Page Revision: 2017/08/04 07:18
This has to be the fastest most compact Day of the Week function I have seen.
credit: TBS user Quazee137 the original thread can be seen here: http://www.thebackshed.com/forum/forum_posts.asp?TID=9281&TPN=2
Function dow(m As Integer,d As Integer,y As Integer) As Integer
' 1 2 3 4 5 6 7
' sun mon tue wed the fri sat
If m < 3 Then
m=m + 12
y=y-1
End If
dow = 1 + (d + ((26 * m+1)/10) - (2 * (y\100)) + y + (y\4) + (y\400) ) Mod 7
End Function