Forum Discussion

QuickbaseAdmin4's avatar
QuickbaseAdmin4
Qrew Member
2 years ago

First Tuesday of the Month

Hey everyone,

I've been trying around with this myself, but with no success. Does anyone know how to write a 'Formula - Checkbox' field that is only true if today = the first Tuesday of the month? 



------------------------------
Quickbase Admin
------------------------------
  • Here is a formula date field which will calculate what the first Tuesday of the month is.  You can then compare it to your own date field to see if it matches. you will need to provide a date for [My Date field] or if you meant the first Tuesday of the current month, then you can use Today() there. 

    There are probably ways to do this with a shorter formula but this has the advantage of being stupid simple and could be adjusted easily for a different first day of the month.



    var date FirstOfTheMonth = FirstDayOfMonth([My Date field]);

    Case(DayOfWeek($FirstOfTheMonth),
    0, $FirstOfTheMonth + Days(2),
    1, $FirstOfTheMonth + Days(1),
    2, $FirstOfTheMonth + Days(0),
    3, $FirstOfTheMonth + Days(6),
    4, $FirstOfTheMonth + Days(5),
    5, $FirstOfTheMonth + Days(4),
    6, $FirstOfTheMonth + Days(3)) 



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • QuickbaseAdmin4's avatar
      QuickbaseAdmin4
      Qrew Member

      Hey Mark,

      Thank you for the help. I will start to play around with this, but just to ask, would you know how to turn your formula into a Boolean expression that says if today = first Tuesday of the current month, then true, else false? 



      ------------------------------
      Quickbase Admin
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        var date FirstOfTheMonth = FirstDayOfMonth(Today());

        var date FirstTuesdayOfTheMonth=
        Case(DayOfWeek($FirstOfTheMonth),

        0, $FirstOfTheMonth + Days(2),
        1, $FirstOfTheMonth + Days(1),
        2, $FirstOfTheMonth + Days(0),
        3, $FirstOfTheMonth + Days(6),
        4, $FirstOfTheMonth + Days(5),
        5, $FirstOfTheMonth + Days(4),
        6, $FirstOfTheMonth + Days(3)) ;

        IF(Today()=$FirstTuesdayOfTheMonth, true)



        ------------------------------
        Mark Shnier (Your Quickbase Coach)
        mark.shnier@gmail.com
        ------------------------------