Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
nuwanhwb87
Contributor III
Contributor III

Roundup time to nearest upper 15 minutes

Hi,

I have below time format data and want to round up every time to upper nearest 15 minutes.

7:15:30 AM -----------7:30:00 AM

7:01:30 AM -----------7:15:00 AM

7:12:30 AM -----------7:15:00 AM

7:22:30 AM -----------7:30:00 AM

 

Please Help

 

Thanks,

Nuwan

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

Try

Time(Ceil( TimeField, 15/24/60 ))

HIC

View solution in original post

5 Replies
hic
Former Employee
Former Employee

Try

Time(Ceil( TimeField, 15/24/60 ))

HIC

nuwanhwb87
Contributor III
Contributor III
Author

Thanks Henric,

That's the answer.

Moreover i want substract above from this 

                                "time(round(frac(CHECK_OUTTIME), 1/24/4) , 'hh:mm:ss TT')"

I used like the below but some times it gets minus values

    time(round(frac(CHECK_OUTTIME), 1/24/4) , 'hh:mm:ss TT') -Time(Ceil( TimeField, 15/24/60 ),'hh:mm:ss TT')

Please help

 

 

hic
Former Employee
Former Employee

You need to explain what you want to do here...

Do you have a check-in time and a check-out time and want to calculate the difference?

Then
Interval(Ceil(CHECK_OUTTIME), 1/24/4)-Ceil(CHECK_INTIME), 1/24/4), 'hh:mm:ss')

could be an option.

nuwanhwb87
Contributor III
Contributor III
Author

Hi,

Thanks for the answer.

Moreover  need to round down the check out time to lower 15 minutes.

 

It means

6.14:00PM -------------6.00:00 PM

6.15:45 PM ------------6:15:00 PM

6.29:00 PM------------ 6:15:00 PM

Please help

hic
Former Employee
Former Employee

Then you should use

Floor(CHECK_OUTTIME, 1/24/4)-Ceil(CHECK_INTIME, 1/24/4)