cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jburrelli Frequent Visitor
Frequent Visitor

How do I convert a $date (an isolate field in mongo) into a readable timestamp?

Online I have a readable timestamp in the data explorer but when I load the data I get a timestamp that is not readable. For example, I get 1.55723E+12

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
v-xicai New Contributor
New Contributor

Re: How do I convert a $date (an isolate field in mongo) into a readable timestamp?

Hi @jburrelli ,

 

When the data is load into the Power BI Desktop, it may change the data type automatically. So try to find the query step named "Change Type" in Query Editor, delete this step, and try it again. If your timestamps is like "1490787085874", and you need convert it to date type, then you can try this code.

 

UTCTime = VAR date = [timestamps ]/(60*60*24*1000) RETURN (DATEVALUE("1/1/1970")+date)

 

7.png

 

 

 

 

 

 

 

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 REPLY 1
Highlighted
v-xicai New Contributor
New Contributor

Re: How do I convert a $date (an isolate field in mongo) into a readable timestamp?

Hi @jburrelli ,

 

When the data is load into the Power BI Desktop, it may change the data type automatically. So try to find the query step named "Change Type" in Query Editor, delete this step, and try it again. If your timestamps is like "1490787085874", and you need convert it to date type, then you can try this code.

 

UTCTime = VAR date = [timestamps ]/(60*60*24*1000) RETURN (DATEVALUE("1/1/1970")+date)

 

7.png

 

 

 

 

 

 

 

 

Best Regards,

Amy

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.