Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. db <- odbcDriverConnect(connection = "Driver={SQL Server Native Client 10.0};Server=server; Database=db;Trusted_Connection=yes;")
  2. results <- sqlQuery(db, "select timestamp from table where some-restriction")
  3.  
  4. attr(results$timestamp,"tzone") <- "UTC"
  5.  
  6. results$timestamp <- as.POSIXlt(results$timestamp)
  7.  
  8. tm <- as.POSIXlt(Sys.time())
  9. tm
  10. [1] "2011-09-20 13:45:01 BST"
  11. attr(tm,"tzone") <- "UTC"
  12. tm
  13. [1] "2011-09-20 13:45:01 UTC"
  14.  
  15. library(lubridate)
  16. tz(results) <- "UTC"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement