> On Jul 26, 2016, at 11:24 AM, kolkata kolkata <kolkata...@gmail.com> wrote: > > Hello Everyone, > > I have a file with time in the following format: > > Time > > 27DEC11:00:30 > > 27DEC11:01:30 > > 27DEC11:02:00 > > ……. > > The time column is factor. I want to convert each time to the following > format: > > 20111211003000 > > 20111211013000 > > 20111211020000 > > (Year)(month)(date)(hr)(min)(sec)
> newTimeDt <- strptime(Time, format="%d%b%y:%H:%M") > newTimeDt [1] "2011-12-27 00:30:00 PST" "2011-12-27 01:30:00 PST" "2011-12-27 02:00:00 PST" > newTimeDt <- as.POSIXct(Time, format="%d%b%y:%H:%M") > newTimeDt [1] "2011-12-27 00:30:00 PST" "2011-12-27 01:30:00 PST" "2011-12-27 02:00:00 PST" > newOut <- format(newTimeDt, "%Y%m%d%H%M") > newOut [1] "201112270030" "201112270130" "201112270200" > newOut <- format(newTimeDt, "%Y%m%d%H%M%S") > newOut [1] "20111227003000" "20111227013000" "20111227020000" > > > Any suggestions in this regard > > regards, > > manik mitra > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. David Winsemius Alameda, CA, USA ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.