[R] DateTime wrong when exporting to csv in R

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Wed Aug 20 14:55:49 CEST 2014

This problem is in Excel or your use thereof, not in R, and is therefore not technically "on topic" here.

FWIW I am aware that localization of Excel can change the default date formats for input. I suspect that your installation of Excel has a different default date format than you are using in R (like MDY) that is attempting to convert the file before you start messing with formats. This would incorrectly interpret some cells and fail entirely for others (leaving those cells as strings). My suggestion is to have R output MDY rather than DMY. If that is not satisfactory then you probably ought to ask for help in an Excel forum.
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
Sent from my phone. Please excuse my brevity.

On August 20, 2014 4:53:41 AM PDT, Sneha Bishnoi <sneha.bishnoi at gmail.com> 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
>I write it to csv file. Whne i open the csv file the date time format
>in some number form .
>So even if I use custome settings from excel to change it into date
>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
>     6
> 2014-08-14 16:13:08.850       A
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list