Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
robindk
Frequent Visitor

Create function to convert Epoch date to DateTime format

Hi,

 

I am using a Odata service which always display date and date time data in Epoch format like this (examples)

For a Date field:

/Date(-2208988800000)/

 

For a DateTime field

/Date(1643042143000+0000)/

 

What I would like, is to have a function I can call - to add new custom coloumn that would convert this to readible date time.

Any ideas?

 

Today I manually do the transformation on each coloumn with steps- Basically I first transform the date coloumn (cleaning it to become just numbers) Step 1-3 and then add the custom coloumn.

1) Transform - Extract - Text Between Delimiters

2) Transform - Extract - 10 first characters

3) Change type to Int64

4) Add custom coloumn  #datetimezone(1970,1,1,0,0,0,0,0) + #duration(0,0,0,[ColoumnName])

 

I would be nice to just have a custom function to call with inputting the original coloumn name and just getting the new formatted coloumn with correct date format. Any suggestions on how this function could look like? 

 

Thanks!

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Overhead of a function is not needed in this case when you can do it with a formula

= #datetimezone(1970,1,1,0,0,0,0,0) + #duration(0,0,0,Number.From(Text.Start(Text.BetweenDelimiters([EpochDate],"(",")"),10)))

View solution in original post

2 REPLIES 2
Vijay_A_Verma
Super User
Super User

Overhead of a function is not needed in this case when you can do it with a formula

= #datetimezone(1970,1,1,0,0,0,0,0) + #duration(0,0,0,Number.From(Text.Start(Text.BetweenDelimiters([EpochDate],"(",")"),10)))

So easy! Thanks

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors