Forum Discussion

ekodami's avatar
ekodami
Helper I
26 days ago
Solved

Converting Epoch Date fields within the import statement

Hi all, I am using a native query to import data from my source table. The date are in Epoch format but the issue is that I do not get the minutes and seconds converted during the import. Below is my...
  • ronrsnfld's avatar
    26 days ago

     

    Three points:

    1. I'm no expert in SQL but depending on the version of SQL you are using in your database, it may be that division of two integers will result in an integer. If that is the case, you may be able to convert the numerator to a float by multiplying by 1.0

     2. Your version of SQL may have builtin epoch converter you can use instead.  If it is PostgreSQL look for the to_timestamp() function.

     3. In power query M code, you could convert your `Epoch StartDate` to a real date using code similar to below

    #"Add Start Date" = Table.AddColumn(#"Previous Step","Actual Start Date", each 
            #datetime(1970,1,1,0,0,0) + #duration(0,0,0,[Epoch StartDate]), type datetime)