<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating Timestamp based on FixedNow() in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609858#M18368</link>
    <description>&lt;P&gt;Back in the day I created a measure to convert Unix time to UTC time. I looked like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;UTCTime = 
VAR UnixDays = MAX([UnixTime])/(60*60*24)
RETURN (DATEVALUE("1/1/1970")+UnixDays)&lt;/PRE&gt;
&lt;P&gt;So, to convert it back from UTC Time to Unix time, you would do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Measure = 
VAR __utc = [UTCTime]
RETURN (__utc - DATEVALUE("1/1/1970"))*60*60*24&lt;/PRE&gt;
&lt;P&gt;So, you would need to know your "epoch" date. For Unix it is 1/1/1970 and it varies depending on which SQL Server flavor you are using. Which version of SQL are you using? MySQL, Oracle, SQL Server, Postgres?&lt;/P&gt;</description>
    <pubDate>Sat, 26 Jan 2019 21:26:38 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2019-01-26T21:26:38Z</dc:date>
    <item>
      <title>Creating Timestamp based on FixedNow()</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609755#M18363</link>
      <description>&lt;P&gt;I have created a "Last Data Refreshed" table using the query below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;&amp;nbsp;&amp;nbsp; LastRefresh = DateTime.From(DateTimeZone.SwitchZone(DateTimeZone.FixedLocalNow(),10)),&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ConvertedtoTable = #table(1, {{LastRefresh}}),&lt;/P&gt;&lt;P&gt;In&lt;/P&gt;&lt;P&gt;&amp;nbsp;ConvertedtoTable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I create a timestamp column based on LastRefresh?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 09:43:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609755#M18363</guid>
      <dc:creator>TimAdams</dc:creator>
      <dc:date>2019-01-26T09:43:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Timestamp based on FixedNow()</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609796#M18364</link>
      <description>&lt;P&gt;If I understand what you are going for, you could turn it into a function like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;let fnLastRefresh = () =&amp;gt;

let
   LastRefresh = DateTime.From(DateTimeZone.SwitchZone(DateTimeZone.FixedLocalNow(),10)),
   ConvertedtoTable = #table(1, {{LastRefresh}})
in
 ConvertedtoTable

in 
    fnLastRefresh&lt;/PRE&gt;
&lt;P&gt;Then just create a custom column based on this function and expand the table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 14:56:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609796#M18364</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2019-01-26T14:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Timestamp based on FixedNow()</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609813#M18365</link>
      <description>&lt;P&gt;Its more, how do I create the timestamp as it is not part of the date column types&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 16:37:46 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609813#M18365</guid>
      <dc:creator>TimAdams</dc:creator>
      <dc:date>2019-01-26T16:37:46Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Timestamp based on FixedNow()</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609831#M18366</link>
      <description>&lt;P&gt;How about you provide an example of the output that you are looking for? Because I apparently don't get what you are talking about, my converted time has a date and time like "1/26/2019 9:55:18 AM" which seems like a timestamp to me but apparently not?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 18:08:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609831#M18366</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2019-01-26T18:08:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Timestamp based on FixedNow()</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609845#M18367</link>
      <description>&lt;P&gt;Sorry I am talking about a SQL Timestamp, which should look something like this -&amp;nbsp;400989863&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did see alot of threads about comnverting a timestamp to a datetime. but not vice versa.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 18:55:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609845#M18367</guid>
      <dc:creator>TimAdams</dc:creator>
      <dc:date>2019-01-26T18:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Timestamp based on FixedNow()</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609858#M18368</link>
      <description>&lt;P&gt;Back in the day I created a measure to convert Unix time to UTC time. I looked like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;UTCTime = 
VAR UnixDays = MAX([UnixTime])/(60*60*24)
RETURN (DATEVALUE("1/1/1970")+UnixDays)&lt;/PRE&gt;
&lt;P&gt;So, to convert it back from UTC Time to Unix time, you would do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Measure = 
VAR __utc = [UTCTime]
RETURN (__utc - DATEVALUE("1/1/1970"))*60*60*24&lt;/PRE&gt;
&lt;P&gt;So, you would need to know your "epoch" date. For Unix it is 1/1/1970 and it varies depending on which SQL Server flavor you are using. Which version of SQL are you using? MySQL, Oracle, SQL Server, Postgres?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 21:26:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609858#M18368</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2019-01-26T21:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating Timestamp based on FixedNow()</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609916#M18369</link>
      <description>&lt;P&gt;I have got it working using your logic as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;&amp;nbsp;&amp;nbsp; LastRefresh = DateTime.From(DateTimeZone.SwitchZone(DateTimeZone.FixedLocalNow(),10)),&lt;BR /&gt;&amp;nbsp;&amp;nbsp; EpochDate= #datetime(1970,1,1,0,0,0),&lt;BR /&gt;&amp;nbsp;&amp;nbsp; TimeStampWorking=LastRefresh-EpochDate,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ConvertedtoTable = #table(3, {{LastRefresh,EpochDate,TimeStampWorking}}),&lt;BR /&gt;&amp;nbsp;&amp;nbsp; #"Renamed Columns" = Table.RenameColumns(ConvertedtoTable,{{"Column1", "Refresh Date"}, {"Column3", "TimeStamp Working"}}),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #"Inserted Total Seconds" = Table.AddColumn(#"Renamed Columns", "Total Seconds", each Duration.TotalSeconds([TimeStamp Working]), type number),&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #"Renamed Columns1" = Table.RenameColumns(#"Inserted Total Seconds",{{"Total Seconds", "Timestamp"}})&lt;BR /&gt;in&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #"Renamed Columns1"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jan 2019 07:09:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Creating-Timestamp-based-on-FixedNow/m-p/609916#M18369</guid>
      <dc:creator>TimAdams</dc:creator>
      <dc:date>2019-01-27T07:09:02Z</dc:date>
    </item>
  </channel>
</rss>

