Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
vinay_bangari
Valued Contributor III

converting a PTP (Precision Time Protocol) string into a date and time?

Does anyone have experience converting a PTP (Precision Time Protocol) string into a date and time? Here are a few examples of the values that are coming in from the data source.


1504720821967

1504720822401

1504720875154

1504720875420

1504720880194

1504720880195

1504720896241

1504720896519

1504720896520

1504720905016

1504720905283

1504721314762

1504721314775

1 Solution

Accepted Solutions

Re: converting a PTP (Precision Time Protocol) string into a date and time?

Then specify it even if the script, if you want (applications will be heavier):

Date(Date#('01.01.1970', 'DD.MM.YYYY') + PTPTimestampField/86400/1000, 'MM/DD/YYYY hh:mm:ss.fff') AS Timestamp

7 Replies

Re: converting a PTP (Precision Time Protocol) string into a date and time?

What date format it should be for 1504720821967??

Life is so rich, and we need to respect to the life !!!

Re: converting a PTP (Precision Time Protocol) string into a date and time?

Something like this should work, but you will need to tweak the divisor depending on the precision of those timestamps (I'm assuming 1000, could be higher):

Date(Date#('01.01.1970', 'DD.MM.YYYY') + PTPTimestampField/86400/1000) AS Timestamp

EDIT: divisor separated for clarity

vinay_bangari
Valued Contributor III

Re: converting a PTP (Precision Time Protocol) string into a date and time?

i want in the following format : 'MM/DD/YYYY '

vinay_bangari
Valued Contributor III

Re: converting a PTP (Precision Time Protocol) string into a date and time?

let me try this

Re: converting a PTP (Precision Time Protocol) string into a date and time?

Then specify it even if the script, if you want (applications will be heavier):

Date(Date#('01.01.1970', 'DD.MM.YYYY') + PTPTimestampField/86400/1000, 'MM/DD/YYYY hh:mm:ss.fff') AS Timestamp

Re: converting a PTP (Precision Time Protocol) string into a date and time?

That is okay, Please provide output you want to see for that date row if you aware the result

Life is so rich, and we need to respect to the life !!!
vinay_bangari
Valued Contributor III

Re: converting a PTP (Precision Time Protocol) string into a date and time?

Thanks a lot saver of the day

Community Browser