Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
MarioS
Contributor II
Contributor II

Round Time to the nearest Minute

Dear Qlikers,

Here is my challenge:

12:40:59  to be 12:41:00

12:40:01 to be 12:40:00

In to time to the nearest minute, How can I do this using the the script;

Thank you

 

Labels (1)
2 Solutions

Accepted Solutions
tresesco
MVP
MVP

@MarioS 

Try like:

Time(Round(Time#(<yourTime>, 'hh:mm:ss'), 1/24/60)) as NearestMinute

View solution in original post

Chanty4u
MVP
MVP

Hi

above tresesco solution is  working as you expected.  

Format:
LOAD * INLINE [
Duration
12:40:50
12:40:05

];

Result:

LOAD *,
Time(Round(Time#(Duration, 'hh:mm:ss'), 1/24/60)) as NearestMinute

Resident Format;

exit SCRIPT;

round.PNG

 

View solution in original post

3 Replies
tresesco
MVP
MVP

@MarioS 

Try like:

Time(Round(Time#(<yourTime>, 'hh:mm:ss'), 1/24/60)) as NearestMinute

MarioS
Contributor II
Contributor II
Author

Thank you So much it works,

But one more question is this work on the below ?

12:40:50 to be 12:41:00

12:40:05 to be 12:40:00

 

Thank you

Chanty4u
MVP
MVP

Hi

above tresesco solution is  working as you expected.  

Format:
LOAD * INLINE [
Duration
12:40:50
12:40:05

];

Result:

LOAD *,
Time(Round(Time#(Duration, 'hh:mm:ss'), 1/24/60)) as NearestMinute

Resident Format;

exit SCRIPT;

round.PNG