-1

I have a column in which time is in the following format: 0815A. I need it to be converted into a time format.

I have tried poxscit but there are some errors.

StatMan
  • 596
  • 1
  • 6
  • 13
  • Can you provide a reproducible example (http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? – Qaswed Jul 27 '16 at 08:46

1 Answers1

2

We can use as.POSIXct specifying the correct format

as.POSIXct(paste0(v1, "M"), format = '%I%M%p')
#[1] "2016-07-27 08:15:00 IST" "2016-07-27 21:20:00 IST"

data

v1 <- c("0815A", "0920P")
akrun
  • 874,273
  • 37
  • 540
  • 662