Qlik Community

Third-Party Qlik Jobs

Area for people to learn more about current Qlik related job postings.

Not applicable

Qlikview Hour Of Day

New to Qlikview:

I need to put a date and time field in individual hour of day fields.  So if my datetime field fell between the hour 8:00:00 and 8:59:59 then 1 else 0 as Myfieldname

Thanks

5 Replies
kumarnatarajan
Valued Contributor

Re: Qlikview Hour Of Day

Hi,

See below script.

if(Num#(Date(DateField,'hh'))=8,1,0) as TimeFlag

Not applicable

Re: Qlikview Hour Of Day

hi

try this

=if(num(fieldnametime)>num(time('8:00:00','hh:mm:ss')) and num(fieldnametime)<num( time( 8:59:59,'hh:mm:ss')),1 , 0 )as Myfieldname

er_mohit
Honored Contributor II

Re: Qlikview Hour Of Day

if(num(time(Datetimefield))>=0.333333 and num(time(Datetimefield))<=0.374988,1,0) as Field

Not applicable

Re: Qlikview Hour Of Day

hi

try like this

=if(num(Time('8:50:00','hh:mm:ss'))>num(time('8:00:00','hh:mm:ss')) and num(time('8:00:00','hh:mm:ss'))<num( time( '8:59:59','hh:mm:ss')),1 , 0 )     as myfield

****************************************************************

=if(num(Time(fieldname,'hh:mm:ss'))>num(time('8:00:00','hh:mm:ss')) and num(time(fieldname,'hh:mm:ss'))<num( time( '8:59:59','hh:mm:ss')),1 , 0 ) as myfield

sunilkumarqv
Valued Contributor II

Re: Qlikview Hour Of Day

Try this

=time(interval([8:00:00]) - below([8:59:59])),'h:mm:ss') as MyFieldname

or

If(8:59:59> 8:00:00,interval( 8:59:59- 8:00:00, 'hh:mm:ss'),interval(8:00:00-8:59:59, 'hh:mm:ss')) as MyFieldname

or


=interval( 8:00:00- 8:59:59, 'hh:mm') a s  MyFieldname

or


set Dateformate=Date(date,'MM/YY/DD hh:mm:ss' )

make Hour(date) as Dhour in yours script


So

then


If(Dhour>8:00:00 and(Dhour <8:59:59)) as MyFieldname