Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
nareshthavidishetty
Creator III
Creator III

Time detail not reflecting

Hi,

Am used the below logic at script level to get the time format,

Script level:   'Time(Time#(BGCMTM, 'hhmmss'), 'hh:mm:ss') as Reporting_Time'


But am getting an issue like as below(For 8:00:00 and 9:00:00 times were missing but in bakend it is available).

image001.png

Thanks..

1 Solution

Accepted Solutions
sunny_talwar

May be try this:

Time(Time#(BGCMTM, 'hmmss'), 'hh:mm:ss') as Reporting_Time


Time(Time#(Num(BGCMTM, '000000'), 'hhmmss'), 'hh:mm:ss') as Reporting_Time

View solution in original post

13 Replies
Chanty4u
MVP
MVP

try this

TimeStamp(

   Alt(

      TimeStamp#(Field,'hhmmss'),

      TimeStamp#(Field,'hh:mm:ss')

      ),

      'hh:mm:ss'

   ) as NewTime

sunny_talwar

May be try this:

Time(Time#(BGCMTM, 'hmmss'), 'hh:mm:ss') as Reporting_Time


Time(Time#(Num(BGCMTM, '000000'), 'hhmmss'), 'hh:mm:ss') as Reporting_Time

Chanty4u
MVP
MVP

sample PFA

LOAD *,TimeStamp(

   Alt(

      TimeStamp#(Date_Value,'hhmmss'),

      TimeStamp#(Date_Value,'hh:mm:ss')

      ),

      'hh:mm:ss'

   ) as New_Date_Value;

Load * inline [

Date_Value

231000

231212

231222

231138

231039

];

nareshthavidishetty
Creator III
Creator III
Author

Hi Sunny,

It results as below which not good.

The business starts at 8:00 and ends at 18:00 here we need to capture the traffic count for every hour.

Untitled.png

Thanks..

sunny_talwar

Do you want to round down each time to its nearest hour?

nareshthavidishetty
Creator III
Creator III
Author

Hi Sunny,

My apologies actually i have used the below logic

Time(Time#(BGCMTM, 'hmmss'), 'hh:mm:ss') as Reporting_Time


The below logic is working
Time(Time#(Num(BGCMTM, '000000'), 'hhmmss'), 'hh:mm:ss') as Reporting_Time


Thanks..


nareshthavidishetty
Creator III
Creator III
Author

Hi,

We can round this each hour by using below logic,

if(right( Time(Time#(Num(BGCMTM, '000000'), 'hhmmss'), 'hh:mm:ss'),2)='00', Time(Time#(Num(BGCMTM, '000000'), 'hhmmss'), 'hh:mm:ss')) as new_Time

Thanks..

sunny_talwar

That is not rounding, rounding can be done like this may be:

Time(Floor(Time#(Num(BGCMTM, '000000'), 'hhmmss'), (1/(24*60))), 'hh:mm:ss') as New_Time

nareshthavidishetty
Creator III
Creator III
Author

Hi Sunny,

It's not rounding

Time(Floor(Time#(Num(BGCMTM, '000000'), 'hhmmss'), (1/(24*60))), 'hh:mm:ss') as New_Time


Thanks..