Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

cancel
Showing results for 
Search instead for 
Did you mean: 
diego_rojas
Partner - Contributor II
Partner - Contributor II

Issue with timestamp field

Hi all, I'm facing this issue:

I have a timestamp field of type 2019-01-01 23:59:59.997 and I need to extract the time from this field but when I try with Timestamp#(MyField, 'YYYY-MM-DD hh:mm:ss.fff') for convert MyField in a number, the result is the same field 2019-01-01 23:59:59.997.

Does anybody knows why is this happening? And how can I solve this issue or if there is other way to extract the time (hh:mm) from this field.

 

Thanks

 

Labels (5)
1 Solution

Accepted Solutions
sunny_talwar

Then give this a shot

Time(Frac(Timestamp#(MyField, 'YYYY-MM-DD hh:mm:ss.fff')), 'hh:mm') as Time

View solution in original post

6 Replies
sunny_talwar

Try this

Time(Frac(MyField), 'hh:mm') as Time
Vegar
MVP
MVP

The use of Timestamp#() does not change the displayed format of your field, but if you will get an underlying numeric value that represent that timestamp. When you have this numeric value then you can apply a variety of date and time manipulations to is such as @sunny_talwar solution above.
diego_rojas
Partner - Contributor II
Partner - Contributor II
Author

I tried but the field appear as null, I checked the type of MyField and it is tagged as $numeric $timestamp $ascii $text
sunny_talwar

Then give this a shot

Time(Frac(Timestamp#(MyField, 'YYYY-MM-DD hh:mm:ss.fff')), 'hh:mm') as Time
diego_rojas
Partner - Contributor II
Partner - Contributor II
Author

Yes I thought to transform field into a number and find the time with the decimal part but it didn't work
diego_rojas
Partner - Contributor II
Partner - Contributor II
Author

Thank you, that's the answer 😄