title: Sqlite epoch datetime conversion
body: <p>So I'm trying to convert epoch time from a sqlite database. I am using the time column the type is Timeswap.</p>
  
  <p>The value stored is: 1383928265 (11/8/2013 11:31:05 AM) <a href="http://www.epochconverter.com/" rel="nofollow noreferrer">http://www.epochconverter.com/</a></p>
  
  <p>The SQL:</p>
  
  <pre><code>var sql = "SELECT session_id, xml, strftime('%s',stopped), strftime('%s',time), orig_title FROM processed";
  </code></pre>
  
  <p>The result: 119360752804800 (10/13/1973 7:45:52 AM)</p>
  
  <p>My converter:</p>
  
  <pre><code>    public static DateTime FromUnixTime(long unixTime)
      {
          var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
          return epoch.AddSeconds(unixTime).ToLocalTime();
      }
  </code></pre>
  
  <p>I made some adjustments to the converter:</p>
  
  <pre><code>    public static DateTime FromUnixTime(long unixTime)
      {
          var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
          var s = unixTime / 86400;
          return epoch.AddSeconds(s).ToLocalTime();
      }
  </code></pre>
  
  <p>But it's yielding: 10/11/2013 6:34:37 AM</p>
  
  <p>I cannot get the correct date from the sqlite database.</p>
  
  <p>EDIT:
  schema</p>
  
  <p><img src="https://i.stack.imgur.com/v25x9.png" alt="SQLite schema"></p>