title: R Find time difference in seconds for YYYY-MM-DD HH:MM:SS.MMM format
body: <p>I'm trying to subtract 2 character vectors containing date time information in the following format:</p>
  
  <pre><code>&gt; dput(train2)
  
  structure(list(time2 = c("2011-09-01 23:44:52.533", "2011-09-05 12:25:37.42", 
  "2011-08-24 12:56:58.91", "2011-10-25 07:18:14.722", "2011-10-25 07:19:51.697"
  ), time3 = c("2011-09-01 23:43:59.752", "2011-09-05 12:25:01.187", 
  "2011-08-24 12:55:13.012", "2011-10-25 07:16:51.759", "2011-10-25 07:16:51.759"
  )), .Names = c("time2", "time3"), row.names = c(NA, 5L), class = "data.frame")
  </code></pre>
  
  <p>I've hunted around and played with <code>zoo</code>, <code>as.Date</code>, <code>as.POSIXct</code>, etc. to try and find the correct code to subtract 2 datetime objects and get an answer in seconds but without luck.</p>
  
  <p>I'd appreciate any suggestions.</p>