-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDateTime reports wrong date if time is greater than 15:59 (tz="America/Los_Angeles") #1498
Comments
The second post on issue #977 gives a specialization of It's not clear to me what the standards and goals are around |
Thank you, e-mu-pi. You have identified the cause of the problem with IDateTime that I am experiencing. |
@MichaelChirico do you think you could take a look at this? (since you've fixed some issues / made improvements with IDate / ITime..) |
@arunsrinivasan sure, i'll put it on my task list. |
Original post a bit unclear. Minimal example:
|
closes #1498; as.IDate doesn't lose timezone data given POSIXct input
IDateTime() generates wrong date if the time portion is greater than 15:59 (tz="America/Los_Angeles")
The conversion of all records that have the time at / after 15:59 of my time zone.
Details of problem at:
http://stackoverflow.com/questions/34786887/why-does-idatetime-convert-to-the-wrong-date
Data in FiveMinute.csv file:
Time,High,Low,Open,Close,Vol
2016/01/13 11:00,4.8100,4.7875,4.8050,4.7900,543
2016/01/13 11:05,4.7950,4.7825,4.7900,4.7925,781
2016/01/13 11:10,4.7925,4.7750,4.7925,4.7775,2787
2016/01/13 11:15,4.7850,4.7775,4.7800,4.7800,659
2016/01/13 17:00,4.7800,4.7700,4.7800,4.7700,371
2016/01/13 17:05,4.7750,4.7700,4.7700,4.7700,158
2016/01/13 17:10,4.7675,4.7550,4.7675,4.7550,288
R script:
library(data.table)
csv1 = "FiveMinute.csv"
dt = fread(csv1)
dput(dt)
as.POSIXct does not change the date
as.POSIXct(dt$Time)
as.POSIXct(dt$Time, "%Y/%m/%d %H:%M", tz="")
these calls produce incorrect output
IDateTime(as.POSIXct(dt$Time))
IDateTime(as.POSIXct(dt$Time, tz=""))
IDateTime(as.POSIXct(dt$Time, tz="America/Los_Angeles"))
IDateTime(as.POSIXct(dt$Time, "%Y/%m/%d %H:%M", tz=""))
IDateTime(as.POSIXct(dt$Time, "%Y/%m/%d %H:%M", tz="America/Los_Angeles"))
dput(IDateTime(as.POSIXct(dt$Time, "%Y/%m/%d %H:%M", tz="America/Los_Angeles")))
dput(IDateTime(as.POSIXct(dt[,Time], "%Y/%m/%d %H:%M", tz="America/Los_Angeles")))
System: Win10x64 R 3.2.2 data.table 1.9.6
The text was updated successfully, but these errors were encountered: