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

Compare two variable of time...

Hello!

I try to compare two variable  in the loading script. Current time must fall within a specified time interval

My script:

let vTimeStart = '05:00am';

let vTimeEnd   = '05:30am';

let curTime    = time#(time((num#(Left(now(1),4))/2400),'hh:mmtt'),'HH:MMTT');

if time('$(curTime)','HH:MMTT') >= time('$(vTimeStart)', 'HH:MMTT') and (time('$(curTime)', 'HH:MMTT') <= time('$(vTimeStart)', 'HH:MMTT')) - error in this row

  //some script

endif

Thanks!

1 Solution

Accepted Solutions
kumarnatarajan
Partner - Specialist
Partner - Specialist

hi,

try this.

Ex;

let vTimeStart = Timestamp(Timestamp#('05:00am','hh:mmtt'),'hh:mmTT');

let vTimeEnd   = Timestamp(Timestamp#('05:30am','hh:mmtt'),'hh:mmTT');

let curTime    = Timestamp(now(),'hh:mmTT');


if '$(curTime)' >= '$(vTimeStart)' and '$(curTime)' <= '$(vTimeStart)' then
set vCondition='True';
ELSE
set vCondition='False';
endif

View solution in original post

2 Replies
Gysbert_Wassenaar

let vTimeStart = time#('05:00am','hh:mmtt');

let vTimeEnd  = time#('05:30am';'hh:mmtt');

let curTime = frac(now());

if $(curTime) >= $(vTimeStart) and $(curTime) <= $(vTimeEnd) then

     // true

else

     // false

end if;


talk is cheap, supply exceeds demand
kumarnatarajan
Partner - Specialist
Partner - Specialist

hi,

try this.

Ex;

let vTimeStart = Timestamp(Timestamp#('05:00am','hh:mmtt'),'hh:mmTT');

let vTimeEnd   = Timestamp(Timestamp#('05:30am','hh:mmtt'),'hh:mmTT');

let curTime    = Timestamp(now(),'hh:mmTT');


if '$(curTime)' >= '$(vTimeStart)' and '$(curTime)' <= '$(vTimeStart)' then
set vCondition='True';
ELSE
set vCondition='False';
endif