Power Query

Epoch dates in Power Query | Excel | Power BI

Inhaltsverzeichnis

This blog will show how to work with Epoch format in both seconds and milliseconds in Power Query. You can use the formulas shown in both Excel und Power BI.

From DateTime format to Epoch

We will start with a regular date and we want to convert it to Epoch format:

Von der Vision zur Umsetzung

Ob Sie gerade erst mit der Automatisierung beginnen oder diese ausbauen, wir helfen Ihnen, Ihre Ideen in wirkungsvolle Lösungen zu verwandeln.

DateTime column

 Convert the date column into a DateTime zone column:

DateTime zone column

Add a calculated column referring to your date column:

Custom DateTime column

Formulas to use

				
					Seconds: 
Number.ToText(Duration.TotalSeconds([Date]-#datetimezone(1970,1,1,0,0,0,0,0))) 
 
Milliseconds: 
Number.ToText(Duration.TotalSeconds([Date]-#datetimezone(1970,1,1,0,0,0,0,0))*1000) 

				
			

Replace [Date] by the column that has your date. 

If you’re exploring these conversions and need additional support, our Power Platform Beratungsleistungen can streamline and optimize your data processes with tailored solutions. We specialize in transforming complex data into actionable insights, ensuring your tools are working at their best.

From Epoch to DateTime

We will start with this Epoch value and we want to convert it to DateTime format:

Epoch value

Add a calculated column referring to your epoch column:

Sind Sie bereit, die Freude an der Automatisierung zu entdecken?

Ob Sie ein Projekt im Sinn haben oder einfach nur wissen möchten, wie wir Ihnen helfen können, wir freuen uns auf ein Gespräch

Custom column formula

Formulas to use

				
					 
Seconds: 
#datetimezone(1970,1,1,0,0,0,0,0) + #duration(0,0,0,Number.From([Epoch])) 
 
Milliseconds: 
#datetimezone(1970,1,1,0,0,0,0,0) + #duration(0,0,0,Number.From([Epoch])/1000) 

				
			

Replace [Epoch] by the column that has your date.

Autor
Power Platform Berater | Experte für Geschäftsprozessautomatisierung
Microsoft Certified Professional (Power Platform Consultant & Solution Architecht)