Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Conditional Formatting on Hours

I have a field with the date / time format, and would like to make a conditional formatting, indepentende the day, month and year, if it occurred after 17hs it stays red, black if not, it's possible do this formatting?

Thank you.

1 Solution

Accepted Solutions
its_anandrjs

Hi Gabriel,

As you say you have timestamp field like below time stamp formats

05/27/2014 17:33:01,2454

05/27/2014 17:34:01,245

05/27/2014 17:35:01,245

05/27/2014 11:33:01,56

Then try this expression by click + sign in the dimension

=if( Text(Time(Timestamp#(YourTimestampFieldHere,'mm/dd/yyyy hh:mm:ss'),'hh:mm:ss')) >= '17:01:00',Red(),Green())

Or

=if(Text(Time(YourTimestampFieldHere,'hh:mm:ss')) >= '17:01:00',Red(),Green())

Eg:-

=if(Text(Time(Timestamp#(TimeField,'mm/dd/yyyy hh:mm:ss'),'hh:mm:ss')) >= '17:01:00',Red(),Green())

Or

=if(Text(Time(TimeField,'hh:mm:ss')) >= '17:01:00',Red(),Green())

View solution in original post

6 Replies
its_anandrjs

Write a expression for that and as you say you have the timestamp field then

If( YourfieldTimestampfield >= '17:00:00', Red(),Black())

Anonymous
Not applicable
Author

use hour function

hour(/*DateField*/) will give you the hour.

so if(hour(/*DateField*/)>17, red(),black()) should do it for you.

Anonymous
Not applicable
Author

Hi, thanks for reply.

I have the current field format as hh: mm: ss this is the correct format to compare?

Anonymous
Not applicable
Author

Hi,

Is not a question about hour, but hour, minute and second, if the column is equal 17:01, the formatting color is red.

its_anandrjs

Hi Gabriel,

As you say you have timestamp field like below time stamp formats

05/27/2014 17:33:01,2454

05/27/2014 17:34:01,245

05/27/2014 17:35:01,245

05/27/2014 11:33:01,56

Then try this expression by click + sign in the dimension

=if( Text(Time(Timestamp#(YourTimestampFieldHere,'mm/dd/yyyy hh:mm:ss'),'hh:mm:ss')) >= '17:01:00',Red(),Green())

Or

=if(Text(Time(YourTimestampFieldHere,'hh:mm:ss')) >= '17:01:00',Red(),Green())

Eg:-

=if(Text(Time(Timestamp#(TimeField,'mm/dd/yyyy hh:mm:ss'),'hh:mm:ss')) >= '17:01:00',Red(),Green())

Or

=if(Text(Time(TimeField,'hh:mm:ss')) >= '17:01:00',Red(),Green())

Anonymous
Not applicable
Author

Thanks!