Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Bala_s
Contributor III
Contributor III

Converting Timestamp format to seconds

Hi Experts,

Need help here!!!

I have one column as AvgTime where i have values like below

1:06:00 AM // This is (hh:mm:ss tt Format)

:51:40   // This is (mm:ss Format)

:11      // This is (ss Format)

I need to present sum(AvgTime) in seconds, how can I convert all above formats to only seconds?

Please help me here to get output.

Regards,

Bala

12 Replies
sunny_talwar

May be this

Interval(FieldName, 'ss')

Bala_s
Contributor III
Contributor III
Author

Hi Sunny,

Tried this but value becomes 0

sunny_talwar

Can you share an image of where you are doing this

Bala_s
Contributor III
Contributor III
Author

Please find below images 1st is Script part and 2nd is list box..

2018-05-25_20-17-40.pngP2018-05-25_20-19-38.png

vvira1316
Specialist II
Specialist II

for following sample scenario what you are expecting as values

1:06:00 AM // This is (hh:mm:ss tt Format)  

     3960 or 00

:51:40   // This is (mm:ss Format)     

     3070 or 40 

:11      // This is (ss Format)  

     11

sunny_talwar

May be try this

Interval(Alt(Num([Avg Speed Ans]), Num(Time#([Avg Speed Ans], 'hh:mm:ss')), Num(Time#([Avg Speed Ans], ':mm:ss')), Num(Time#([Avg Speed Ans], ':ss'))), 'ss') as [Avg Speed Ans]

Bala_s
Contributor III
Contributor III
Author

Thanks Sunny for help...

Pls find below snapshot, might be calculation for seconds is wrong..

2018-05-25_21-09-07.png

sunny_talwar

What is your expected output my friend?

Bala_s
Contributor III
Contributor III
Author

My scenario is like below

Ex: Data is 01:06:00 AM

I should get convert above into seconds....(3960 seconds) like wise I need to get for all above example cases.