[R] Time and Date formatting

Rui Barradas ruipbarradas at sapo.pt
Tue Apr 23 20:54:33 CEST 2013


Hello,

See if any of the following will do.


DATE <- "14/07/2010"
TIME <-  "20:21"
paste(DATE, TIME)
as.POSIXct(paste(DATE, TIME), format = "%d/%m/%Y %H:%M")


Hope this helps,

Rui Barradas

Em 23-04-2013 19:46, Ayyappa Chaturvedula escreveu:
> Dear Group,
>
> I have  a problem with time date formatting.  I have Date and Time in
> different columns in a .csv file and want to have a column with Date and
> Time together.  I could format the date into the right mode using strptime
> and as.Date functions.  I am not able to do that with TIME column. I
> appreciate your help in solving this issue.  Currently the TIME column is
> in character mode.
>
>
>    DATE              TIME                   DATETIME
> 14/07/2010       20:21    *Want:* 14/07/2010  20:11
>
> Thanks in advance for your help.
>
> Regards,
> Ayyappa
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



More information about the R-help mailing list