Welcome Guest, you are in: Login

Fruit Of The Shed

Navigation (MMBasic)






Search the wiki

»


Page History: Quick Day Of Week (and tiny too)

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: 2017/06/07 20:35


This has to be the fastest most compact Day of 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,d,y)

'  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