2

This seems very simple, but fasttime package is not working to convert dates.

library(fasttime)
z="2011-01-01"

fastPOSIXct(z)
>"2010-12-31 18:00:00 CST"

Can someone explain what is happening or what I have missed?

wolfsatthedoor
  • 7,163
  • 18
  • 46
  • 90
  • 1
    `POSIXct` is not a date. The timestamp it gives you is midnight UTC for that date. I'm not familiar with `fasttime`, though, so I might be missing something. – r2evans May 21 '19 at 20:52
  • Try `as.Date(fastPOSIXct(z))` – r2evans May 21 '19 at 20:54
  • I think it had to do with the timezone, I manually forced the timezone to be mine, and it fixed it! – wolfsatthedoor May 21 '19 at 22:02
  • I don't know why you're using `fasttime`: that package is for *"timestamp manipulation"*, and it appears like you are working with dates. If you are just using dates, that package is not necessary (and will require overhead of converting back and forth). If you need just dates, perhaps the [`lubridate`](https://cran.r-project.org/web/packages/lubridate/index.html) package is better suited. – r2evans May 21 '19 at 23:03

0 Answers0