title: date-time-string to UNIX time with milliseconds
body: <p>I need to convert a date/time string to UNIX timestamp including the milliseconds. As the timetuple() does not include milli or microseconds I made a short workaround. But I was wondering, is there a better/nicer way to do this?</p>
  
  <pre><code>import datetime as dt
  import time
  
  timestamp = '2018-01-19 10:00:00.019'  # example of input time string 
  tmp       = timestamp.split('.')
  millisec  = tmp[-1]                    # extracting only milli-seconds
  UX_time = time.mktime(dt.datetime.strptime(tmp[0], '%Y-%m-%d %H:%M:%S').timetuple()) + float(millisec)/1e3
  
  print(UX_time)
  </code></pre>
  
  <blockquote>
    <p>1516352400.019</p>
  </blockquote>
  
  <p>I realize my timezone is off by one hour, so you might be getting</p>
  
  <pre><code>print(UX_time)
  </code></pre>
  
  <blockquote>
    <p>1516356000.019</p>
  </blockquote>