title: Converting numeric time to datetime POSIXct format in R
body: <p>I have a data frame containing what should be a datetime column that has been read into R. The time values are appearing as numeric time as seen in the below data example. I would like to convert these into datetime POSIXct or POSIXlt format, so that date and time can be viewed.</p>
  
  <pre><code>tdat &lt;- c(974424L, 974430L, 974436L, 974442L, 974448L, 974454L, 974460L, 974466L, 974472L,
            974478L, 974484L, 974490L, 974496L, 974502L, 974508L, 974514L, 974520L, 974526L,
            974532L,974538L)
  </code></pre>
  
  <p><code>974424</code> should equate to <code>00:00:00 01/03/2011</code>, but the do not know the origin time of the numeric values (i.e. 1970-01-01 used below does not work). I have tried using commands such as the below to achieve this and have spent time trying to get <code>as.POXISct</code> to work, but I haven’t found a solution (i.e. I either end up with a POSIXct object of NAs or end up with obscure datetime values).</p>
  
  <p>Attempts to convert numeric time to datetime:</p>
  
  <pre><code>datetime &lt;- as.POSIXct(strptime(time, format = "%d/%m/%Y %H:%M:%S"))
  datetime &lt;- as.POSIXct(as.numeric(time), origin='1970-01-01') 
  </code></pre>
  
  <p>I am sure that this is a simple thing to do. Any help would be greatly received. Thanks! </p>