[R] DateTime wrong when exporting to csv in R

David Winsemius dwinsemius at comcast.net
Thu Aug 21 00:32:57 CEST 2014


On Aug 20, 2014, at 1:48 PM, David Winsemius wrote:

> 
> On Aug 20, 2014, at 4:53 AM, Sneha Bishnoi wrote:
> 
>> Hi All!
>> 
>> This seems to be trival but I am not able to find a solution for it.
>> I have a dataframe with datetime columns in form of  ("%d/%m/%y %H:%M:%OS").
>> 
>> I write it to csv file. Whne i open the csv file the date time format are
>> in some number form .
> 
> What does "same number form" mean?
> 
>> So even if I use custome settings from excel to change it into date time
>> format, it gives me wrong value.
>> 
>> My data frame is as below:
>> 
> 
> PostDate                            Status                 ArrTime              NumGuests
> 2014-08-14 16:13:08.850       O                    2012-01-13 00:00:00.000    6
> 2014-08-14 16:13:08.850       A
> 
>> 
>> -SB
>> 
>> 	[[alternative HTML version deleted]]
> 
> The reason you are asked to post in plain text is to avoid the line wrapping and other mangling of data that html formatting causes. I've reformatted your posting to be what appears to be a very incomplete representation of your file.
> 
> I substituted tabs for the varying number of space
> -- opened and empty excel workbook
> -- formatted the first and third columns with a custom format for a date-time in the POSIX standard format (or a close as I can get to that in Excel, anyway)  as illustrated in the attached .png file.

The server seems to be rejecting PNG files (although they were accpted earlier). So trying with a PDF version of the PNG file:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Excel_dat_fmt.pdf
Type: application/pdf
Size: 81483 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20140820/1c97b9ed/attachment.pdf>
-------------- next part --------------


-- 
David.
> 
> -- open the tab-separated file.
> 
> Dates and times all agree.
> 
> 
> 
> 
>> 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.
> 
> David Winsemius
> Alameda, CA, USA
> 
> ______________________________________________
> 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.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list