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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
android1
Post Patron
Post Patron

Using 1904 date system like in Excel

Hi,

 

When I pull a date and time column through Web Service into Power BI (07/03/2016 1:00 PM) it reads as /Date(1457355600000)/ . How do I get it to display correctly? Something like the 1904 date system in Excel maybe?

 

 

2 REPLIES 2
Grumelo
Advocate II
Advocate II

Let me provide you a full answer and not just links and hints

 

You can achieve the conversion this way in Power Query

 

 

The step to execute to do the transformation

= Table.TransformColumns(#"<previous step name>",{{"<column name to update>", DateFromJson}})

The code of the Power Query custom function

let DateFromJson = (date as any) as any =>
     let
        input = if date is null then "/Date(00000000000000)/"else date,
         Stripped = if Text.StartsWith(input, "/Date(") and Text.EndsWith(input, ")/") then Text.Range(input, 6, Text.Length(input) - 😎 else error "Not a date",
         Position = Text.PositionOfAny(Stripped, {"+", "-"}, 1),
         Parts = if Position < 0 then { Stripped, "0" } else { Text.Range(Stripped, 0, Position), Text.Range(Stripped, Position) },
         NumberParts = { Number.FromText(Parts{0}), Number.FromText(Parts{1}) },
         Result = Date.FromText("1/1/1970") + #duration(0, 0, 0, (NumberParts{0} + 36000 * NumberParts{1}) / 1000),
        output = if Date.Year(Result) = 1970 then null else Result

     in
  output 
 in DateFromJson

 

Greg_Deckler
Community Champion
Community Champion

See my response here:

http://community.powerbi.com/t5/Desktop/Convert-json-DateTime-format/m-p/28712

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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