title: How can I convert a DateTime to the number of seconds since 1970?
body: <p>I'm trying to convert a C# DateTime variable to Unix time, ie, the number of seconds since Jan 1st, 1970.  It looks like a DateTime is actually implemented as the number of 'ticks' since Jan 1st, 0001.</p>
  
  <p>My current thought is to subtract Jan 1st, 1970 from my DateTime like this:</p>
  
  <pre><code>TimeSpan span= DateTime.Now.Subtract(new DateTime(1970,1,1,0,0,0));
  return span.TotalSeconds;
  </code></pre>
  
  <p>Is there a better way?</p>