[R] Converting the data in year month day hour and minutes to date

Rui Barradas ruipbarradas at sapo.pt
Tue Feb 19 19:41:54 CET 2013


Hello,

Try the following.


x <- "2008-01-01 02:30"
as.POSIXct(x, format = "%Y-%m-%d %H:%M")


Hope this helps,

Rui Barradas

Em 19-02-2013 17:47, Janesh Devkota escreveu:
> Hi ,
>
>
>
> I am trying to convert the date as factor to date using "as.date" function
> in R. I have the date in the following format
>
> 2008-01-01 02:30
>
>
>
> I tried to use the following command :
>
> as.Date(mydata$Date, format="%y-%m-%d  ")
>
>
>
> Can somebody help me with this ? I was able to convert the format with no
> hour but getting difficulty with hour included.
>
>
>
> Thank you.
>
>
>
> Janesh
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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