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

Convert C# date ticks to DateTime

Is it possible to convert a column in Power BI that contains a C# Date tick value to a DateTime?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User
Super User

Re: Convert C# date ticks to DateTime

I am sure you could do it in Power Query. 

 

Read this. http://stackoverflow.com/questions/1489243/how-can-i-convert-ticks-to-a-date-format

 

in Power Query, add a new column and then use the formula, above to convert the date tick to a serial number

 

I think you can then convert the number to a date with the UI (although I have never tried it).  Worst case you should be able to use a power query date fipunction to convert it. 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

winter69 Frequent Visitor
Frequent Visitor

Re: Convert C# date ticks to DateTime

Thanks Matt.  I suspected this was the direction I needed to go in, just wanted to be sure I hadn't missed something obvious.

View solution in original post

4 REPLIES 4
Highlighted
Super User
Super User

Re: Convert C# date ticks to DateTime

I am sure you could do it in Power Query. 

 

Read this. http://stackoverflow.com/questions/1489243/how-can-i-convert-ticks-to-a-date-format

 

in Power Query, add a new column and then use the formula, above to convert the date tick to a serial number

 

I think you can then convert the number to a date with the UI (although I have never tried it).  Worst case you should be able to use a power query date fipunction to convert it. 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

winter69 Frequent Visitor
Frequent Visitor

Re: Convert C# date ticks to DateTime

Thanks Matt.  I suspected this was the direction I needed to go in, just wanted to be sure I hadn't missed something obvious.

View solution in original post

bradnywells Frequent Visitor
Frequent Visitor

Re: Convert C# date ticks to DateTime

Check this one, more about....date conversion

 

Wells

hugoberry Member
Member

Re: Convert C# date ticks to DateTime

Try the following conversion

=DateTime.FromFileTime([ticks])-#duration(584388,0,0,0)

 

The FromFileTime counts the ticks from 1600/01/01 so that's why we have the duration of 584388 days to offset this.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 67 members 1,241 guests
Please welcome our newest community members: