I often read data from Oracle into R. To get around the TIMESTAMP format in some of my tables, I read in the column in as a character string with TO_CHAR in my SQL statement.
However, I want to convert the data held in the string back into a date + time format that R can utilize. Unfortunately,I have no idea as to how to best do this, especially considering the AM/PM component. Stripping out the date is easy enough, but I have no idea as to how to retain the time part of each record.
Here are a few records of data:
c("31-JUL-12 10.08.35.432 AM", "31-JUL-12 08.53.18.316 AM", "18-JUL-12 01.17.52.939 PM",
"13-AUG-12 05.34.11.405 PM", "15-AUG-12 02.04.31.505 PM", "21-AUG-12 09.10.03.976 AM"
)
One note: these data are timezone EST.
Any help will be greatly appreciated!
If you deal with dates/times much, you should familiarize yourself with
?strptimeNote that I assumed that by “EST” you really meant Eastern time in New York, NY. From
help(timezone):