title: What is the best way to insert python datetime in rethinkdb?
body: <p><a href="http://rethinkdb.com/" rel="nofollow">RethinkDB</a> is a wonderfull and very handy NoSQL Database engine. I looking for the best way to insert Python datetime objects. RethinkDB strores UTC timestamps, so I found a solution to convert my datetime object in the right format.</p>
  
  <p>I use this litle function to convert my datetime object in somethink RethinkDB understand :</p>
  
  <pre><code>import calendar
  from datetime import datetime
  import rethinkdb as r
  
  
  def datetime_to_epoch_time(dt):
      timestamp = calendar.timegm(dt.utctimetuple())
      return r.epoch_time(timestamp)
  
  title = u'foobar'
  published_at = '2014-03-17 14:00'
  
  # firts I convert 2014-03-17 14:00 to datetime
  dt = datetime.strptime(published_at, '%Y-%m-%d %H:%M')
  
  # then I store the result
  r.table('stories').insert({
      'title': title,
      'published_at': datetime_to_epoch_time(dt),
  }).run()
  </code></pre>
  
  <p>My current timezone is CET (GMT + 2 hours)
  Is this a good solution for storing my dates in rethinkdb or a better solution exists ?</p>
  
  <p>Thanks for your help</p>