Forum Discussion

WallaceYeboah's avatar
WallaceYeboah
Qrew Member
5 years ago

Rounding Time to nearest quarter

 I was wondering if there was a way to round the time in/out to the nearest quarter hour?

This is my current formula:

var duration RoundedClockIn = Round([Clock In Date Time] - ToTimeOfDay("12:00 am"), Minutes(15));

ToTimeOfDay("12:00 am") + $RoundedClockIn

I keep receiving this error "The operator "-" can't be applied on types date/time, timeofday.

Any help would be greatly appreciated 


------------------------------
Wallace Yeboah
------------------------------
  • try this

    var datetime MidnightOfClockInDay = ToTimestamp(ToDate([Clock In Date Time]), ToTimeOfDay("12:00 am"));

    var duration RoundedDuratonfromMidnight = Round([Clock In Date Time] - $MidnightOfClockInDay, Minutes(15));

    ToTimeOfDay("12:00 am") + $RoundedDuratonfromMidnight

    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • WallaceYeboah's avatar
      WallaceYeboah
      Qrew Member
      Thanks for the response Mark! I'm still getting this error for the last line of code:


      "Expecting duration but found timeofday"

      ------------------------------
      Wallace Yeboah
      ------------------------------
    • WallaceYeboah's avatar
      WallaceYeboah
      Qrew Member
      Actually disregard that last message. Its working now. Thanks a lot!

      ------------------------------
      Wallace Yeboah
      ------------------------------
      • CourtneahThomas's avatar
        CourtneahThomas
        Qrew Member
        Wallace Yeboah,  how did you get it to work?  I am getting an error message on the last line that says "expecting text but found time of day"

        ------------------------------
        Courtneah Thomas
        ------------------------------