title: Storing dates and datetimes using the unix epoch
body: <p>I need a universal way to store dates and datetimes in several databases (for now Sqlite, MySql and PostgreSql).
  I need datetimes to have microseconds precision.</p>
  
  <ul>
  <li>Sqlite does not have date and datimes built in.</li>
  <li>MySql datetime does not have microseconds precision.</li>
  </ul>
  
  <p>So i thought to keep dates as integers (4 bytes) - days since the unix epoch, and datetimes as integers (8 bytes) - microseconds since the unix epoch.</p>
  
  <p>Questions:</p>
  
  <ol>
  <li>What's the right way to convert a date to days since unix epoch? I found this: <code>time.time()/86400</code> (python). </li>
  <li>Is it robust to keep datetimes as timestamps? What about the leap seconds - will this influence the accuracy? What if at some point in time a future date was stored as timestamp but later a leap second appeared?</li>
  <li>Any other issues?</li>
  </ol>