[R] Odp: excel dates and times in R
Petr PIKAL
petr.pikal at precheza.cz
Fri Aug 5 14:43:33 CEST 2011
Hi
>
> Hello,
>
> I am having some fun dealing with dates and times. My input is a excel
csv
> file with two columns with data in the following format:
>
> date time
> 25-Jun-1961 04:00:00
>
> i.e. day - month - year hour:min:sec
>
> I would like to have a single object in R that combines these and
converts
> them into a sensible R format (e.g.
> ISOdatetime(1961,06,25,04,00,00,tz="GMT").
>
> I have played with the function chron and also strptime but can't seem
to
> get them to work.
Maybe you did not set appropriate locale. See
Sys.getlocale()
> Sys.setlocale("LC_TIME","us")
[1] "English_United States.1252"
> strptime(paste(date, time, sep=" "), format="%d-%b-%Y %H:%M:%S")
[1] "1961-06-25 04:00:00"
>
But AFAIK Jun is used in Great Britain similarly like in US so you shall
not have problems.
Regards
Petr
>
> Can anybody help me out please?
>
> Thanks
>
> Bevare
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/excel-dates-
> and-times-in-R-tp3720887p3720887.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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