I have input data with date and time stamps as "140128142257"
which is the equivalent of "14/01/28 14:22:57"
or "%Y/%m/%d %H:%M:%S"
.
I cannot get R to read this in so I can convert it to a usable date and timestamp. Any helpful advice would be appreciated.
Here is what I have tried:
datetime <- as.POSIXct(strptime(date[,2],format="%Y%m%d%H%M%S")
However this just gives NA * length of array.
The uppercase %Y
is used for four-digit years. You have to use %y
for two-digit years.
strptime("140128142257", format = "%y%m%d%H%M%S")
# [1] "2014-01-28 14:22:57"