Discussions

Expand all | Collapse all

Rounding Time to nearest quarter

  • 1.  Rounding Time to nearest quarter

    Posted 16 days ago
     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
    ------------------------------


  • 2.  RE: Rounding Time to nearest quarter

    Posted 15 days ago
    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
    ------------------------------



  • 3.  RE: Rounding Time to nearest quarter

    Posted 15 days ago
    Thanks for the response Mark! I'm still getting this error for the last line of code:


    "Expecting duration but found timeofday"

    ------------------------------
    Wallace Yeboah
    ------------------------------



  • 4.  RE: Rounding Time to nearest quarter

    Posted 15 days ago
    Actually disregard that last message. Its working now. Thanks a lot!

    ------------------------------
    Wallace Yeboah
    ------------------------------