Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
spandita
Partner - Contributor
Partner - Contributor

Time comparison with an existing date-time combined field

I want to create one field having 15 min time intervals. Following example can be followed.I want to do the below task.

if (Exec_Time> 9 PM and Exec_Time <9.30 PM,'9 to 9.30 PM','NA') as new_field 

Note:I have written the above script in edit script window(not in expressions)

for all the rows of straight table I am getting new_field value as 'NA',even if the Exec_Time lies between 9 to 9.30 PM.Please advise on how to compare this time field.Exec_Time is a combination of date and time.(e.g,3/14/2019 9:15:00)

 

Labels (1)
2 Replies
mrtinsjoao
Contributor III
Contributor III

I haved the same doubt.
The solution that i had was convert to number and compare numbers
if (num(Exec_Time)> num('9 PM') and num(Exec_Time) <num(9.30 PM),'9 to 9.30 PM','NA') as new_field
Vegar
MVP
MVP

You could get the correct 15 min time interval by using the following script

Time(Round(frac(Exec_Time), 15 / 1440)) as new_field