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: 
Not applicable

Formatting Time in Qlikview

Hi there,

I am quite new to Qlikview and needed some assistance with formatting time. Currently, one of my fields 'MyTime' is showing data as:

7:48:20 AM

14:45:54 PM

Can someone please help me in rounding off the seconds (or just getting rid of the seconds) so that the time appears as:

7:48

14:46

Any help will be much appreciated.

Regards,

Patrick

1 Solution

Accepted Solutions
MarcoWedel

Hi,

if your MyTime field is already time/dual (underlying numerical value formatted as time) and you like to round off to minutes, then

Time(Floor(MyTime, 1/1440),'hh:mm')

should do.

If your MyTime field is already time/dual (underlying numerical value formatted as time) and you like to keep the numerical value (incl seconds), then

Time(MyTime, 'hh:mm')

should do.

If your MyTime field is text (no underlying numerical value) and you like to round off a newly generated numerical representation to minutes, then

Time(Floor(Time#(MyTime, 'hh:mm:ss TT'),1/1440), 'hh:mm')

should do.

If your MyTime field is text (no underlying numerical value) and you like to keep the seconds in a newly generated numerical representation, then

Time(Time#(MyTime, 'hh:mm:ss TT'), 'hh:mm')

should do.

hope this helps

regards

Marco

View solution in original post

4 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Use Time format HH:mm in the number dialog, or use Time(myField, 'HH:mm') to format in the expression.

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
MarcoWedel

Hi,

if your MyTime field is already time/dual (underlying numerical value formatted as time) and you like to round off to minutes, then

Time(Floor(MyTime, 1/1440),'hh:mm')

should do.

If your MyTime field is already time/dual (underlying numerical value formatted as time) and you like to keep the numerical value (incl seconds), then

Time(MyTime, 'hh:mm')

should do.

If your MyTime field is text (no underlying numerical value) and you like to round off a newly generated numerical representation to minutes, then

Time(Floor(Time#(MyTime, 'hh:mm:ss TT'),1/1440), 'hh:mm')

should do.

If your MyTime field is text (no underlying numerical value) and you like to keep the seconds in a newly generated numerical representation, then

Time(Time#(MyTime, 'hh:mm:ss TT'), 'hh:mm')

should do.

hope this helps

regards

Marco

Not applicable
Author

Thank you so much.

Kind regards,


Patrick

MarcoWedel

You're welcome

regards

Marco