[R] Converting characters back to Date and Time

PIKAL Petr petr@p|k@| @end|ng |rom prechez@@cz
Wed Sep 1 14:27:21 CEST 2021


Hi

You can use as.POSIXct function
https://stackoverflow.com/questions/19172632/converting-excel-datetime-seria
l-number-to-r-datetime

But you should preferably try to read the date as character vector and then
convert it to date and time.

Cheers
Petr

> -----Original Message-----
> From: R-help <r-help-bounces using r-project.org> On Behalf Of Eliza Botto
> Sent: Tuesday, August 31, 2021 10:26 PM
> To: r-help using r-project.org
> Subject: [R] Converting characters back to Date and Time
> 
> DeaR useR,
> 
> I read an excel column in R having Date and time (written in the same
cell) as
> follow,
> 
> 06/18/18 10:00
> 
> 06/18/18 11:00
> 
> 06/18/18 12:00
> 
> In R environment, they are read as
> 
> 43269.42
> 
> 43269.46
> 
> 43269.50
> 
> Is there a way to covert these characters back to the original format?
> 
> Thank-you very much in advance.
> 
> 
> Eliza Botto
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help using 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.


More information about the R-help mailing list