I have \"datetimes\" like this:
02FEB2015:00:06:00.000000
and need to extract the time as:
06:00
Tried:
When converting character to POSIXlt
class, you need to specify exactly the same format as how the character is formulated. You can use normal strptime
and format
functions, an example:
As commented by @Zheyuan but slightly different:
format(strptime('02FEB2015:00:06:00.000000', "%d%b%Y:%H:%M:%S"), "%M:%S")
# [1] "06:00"