[R] Date conversion issue

Henrique Dallazuanna wwwhsd at gmail.com
Wed Mar 17 20:36:54 CET 2010


Use %y indeed of "%Y".

On Wed, Mar 17, 2010 at 12:00 PM, ManInMoon <xmoon2000 at googlemail.com> wrote:
>
> I am parsing dates as follows:
>
>> z[1:10,1:3]
>    V1       V2           V3
> 1    0 03/02/09 22:20:51.274
> 2  100 03/02/09 22:28:18.801
> 3  200 03/02/09 22:33:33.762
> 4  300 03/02/09 22:40:21.826
> 5  400 03/02/09 22:41:38.361
> 6  500 03/02/09 22:42:50.882
> 7  600 03/02/09 22:45:19.885
> 8  700 03/02/09 22:48:55.558
> 9  800 03/02/09 22:51:21.112
> 10 900 03/02/09 22:58:41.860
>
>>zdates<-as.POSIXct(strptime(paste(z[,2],z[,3]), "%d/%m/%Y
> %H:%M:%OS"),origin="1970-01-01" );
>
>> head(zdates)
> [1] "0009-02-03 22:20:51 GMT" "0009-02-03 22:28:19 GMT" "0009-02-03 22:33:34
> GMT"
> [4] "0009-02-03 22:40:22 GMT" "0009-02-03 22:41:38 GMT" "0009-02-03 22:42:51
> GMT"
>
>
> Can anyone tell me why I see YEAR as "0009" instead of 2009?
>
>
> --
> View this message in context: http://n4.nabble.com/Date-conversion-issue-tp1596548p1596548.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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O



More information about the R-help mailing list