Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Partner
Partner

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

 

1 Solution

Accepted Solutions

Re: Issue with timestamp field

Then give this a shot

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

Re: Issue with timestamp field

Try this

Time(Frac(MyField), 'hh:mm') as Time
Partner
Partner

Re: Issue with timestamp field

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.
Please ekskuse my Norglish and Swenglish typos.
Partner
Partner

Re: Issue with timestamp field

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

Re: Issue with timestamp field

Then give this a shot

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

Re: Issue with timestamp field

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

Re: Issue with timestamp field

Thank you, that's the answer 😄