That's surprising. It works for me, as illustrated below:
# what you did
as.POSIXct(x = "02:27:16 05-Mar-2019",
tz = "",
format = "%H:%M:%S %m/%d/%Y")
#> [1] NA
# the above expects date in this form: "02:27:16 03/05/2019"
# what I did
as.POSIXct(x = "02:27:16 05-Mar-2019",
format = "%H:%M:%S %d-%b-%Y")
#> [1] "2019-03-05 02:27:16 UTC"
# this one expects date in this form: "02:27:16 05-Mar-2019"
Can you please provide a REPRoducible EXample of your problem of getting NA using my code?
In case you don't know how to make a reprex, here's a great link:
Here is what am doing
srdetails=read_xlsx(file.choose())
Am choosing the data from excel, the date stored in excel in GMT is like 2/8/19 10:54 PM
but when i do this , it shows as numbers as below
head(srdetails$Assigned On GMT)
[1] "43504.954282407409" "43504.956446759257" "43504.943159722221" "43504.880810185183"
[5] "43504.846585648149" "43504.837731481479 ===> So the problem is here itslef?
typeof(srdetails$Assigned On GMT)
[1] "character"
srdetails$Assigned On GMT<-as.POSIXct(srdetails$Assigned On GMT, tz="", format = "%H:%M:%S %d-%b-%Y")
srdetails$`Assigned On GMT
output as all N/As
class(srdetails$Assigned On GMT) shows
[1] "POSIXct" "POSIXt