Skip to content
Prev 181120 / 398503 Next

help with gsub and date pattern

Dear List,

I am having a problem using gsub to remove dates from a date/time string.

For example:

x<-c("5/31/2009 12:34:00","6/1/2009 1:14:00")

I would like to remove the date and have just the time.

I have tried:
gsub("[0-9+]/[0-9+]/[0-9+]","",x)

and various versions.  I think my problem is that the / is a special character and is telling it something that I don't mean.  I would appreciate any suggestions on how to proceed.

Thanks,

Tim



Tim Clark
Department of Zoology 
University of Hawaii