Skip to content
Back to formatted view

Raw Message

Message-ID: <ca44b3d71ab74492b660c4c8df343d9f@SRVEXCHCM1302.precheza.cz>
Date: 2021-09-01T12:27:21Z
From: PIKAL Petr
Subject: Converting characters back to Date and Time
In-Reply-To: <AS8P194MB099979E9FD39C8A3705261579ACC9@AS8P194MB0999.EURP194.PROD.OUTLOOK.COM>

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 at r-project.org> On Behalf Of Eliza Botto
> Sent: Tuesday, August 31, 2021 10:26 PM
> To: r-help at 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 at 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.