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

parsing millisecond time stamps

Hello (again)!

I'm having continued struggles with millisecond-level times. I'm loading an external text file that has timestamps like this:

2014-01-01 23:59:41.600

2014-01-01 23:59:41.950

In the script, I read the field like this:

FRAC(TIMESTAMP#(external_timestamp_field,'YYYY-MM-DD hh:mm:ss.fff'))     to get just the timestamp

I also want to round that DOWN to the nearest whole second. In other words, I want to truncate away the milliseconds. I'm trying to do it like this:

FLOOR (FRAC(TIMESTAMP#(external_timestamp_field,'YYYY-MM-DD hh:mm:ss.fff')), 1/(24*60*60)).

I *think* this leaves me in a good place. Note that I'm not forcing any formatting codes, so these values appear in QV as long, ugly decimals.

Much later, I'm aggregating on the truncated-to-nearest-second field, but the aggregations are misbehaving. Am I treating these times properly?

10 Replies
Not applicable
Author

Yes, I do need to preserve that millisecond detail... at least for a portion of the of the time I'm working with the data in QV. I just posted a question to the forum that goes into exactly that. That question is here: better way to get time-weighted average than join + peek + groupby?

If you have any input on the specifics, I definitely need the help! In the interest of message board clarity, please use the linked question above if you can speak to that question.

As always, thank you for your continued help! (You've responded to me in several other threads.)