Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with date() in a if statement

Hello,

I defined a variable vHour with the actual hour

LET vHour = date(localtime(),'hh');

and now I wanted to test if vHour is 00

if vHour = '00' then ...

but it doesnt work. I also tested this:

if vHour = date(time('00:00:00'),'hh') then ...

Pleas help me

best regards

Ingo Placzek

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Ingo

The Date function changes the text representation of the date value, but it returns the full date/time value (see 'dual' in the manual).

To get the time in hours, you could use text(date(localtime(),'hh')) or round(frac(localtime())*24, 1)

Jonathan

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

View solution in original post

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Ingo

The Date function changes the text representation of the date value, but it returns the full date/time value (see 'dual' in the manual).

To get the time in hours, you could use text(date(localtime(),'hh')) or round(frac(localtime())*24, 1)

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

thanks, it works 😉