The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Need formula by SnappingTurtle 2005-05-04 14:40:35
Assume that the days of the week are numbered 0-6 starting with Sunday. If a given day of the month is M and that same day is day of the week W, what formula returns which [Sunday|Monday|Tuesday|etc] of the month that day is?

E.g, if M=2 and W=1 (Monday) then we intuitively know that it's the first Monday of the month. What formula returns the desired result of 1? If M=8 and W=3 (Wednesday), the formula should return 2 (it's the second Wednesday of the month).

[ Reply ]
  (M-1 % 7) + 1 (n/t) by YakkoWarner2005-05-04 14:43:50
    Sunday May 8: doesn't work by SnappingTurtle2005-05-04 15:04:56
      Whoops, /s/%/\/ by YakkoWarner2005-05-04 15:16:24
        And what guarantees that 7 divides M-1? by jiteo2005-05-04 15:18:40
          Integer division. by YakkoWarner2005-05-04 15:23:26
  M mod w should get you the desired result (n/t) by Yazdi2005-05-04 14:44:51
    Friday the 13th: doesn't work by SnappingTurtle2005-05-04 15:06:15
  What about just by jiteo2005-05-04 15:16:14
    No wait, ignore that. (n/t) by jiteo2005-05-04 15:17:36
  Suggested simplification by kf4oyt2005-05-04 17:29:07

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)