[R] Minute Difference

Jim Lemon jim at bitwrit.com.au
Sat Oct 6 06:49:54 CEST 2012


On 10/05/2012 10:56 PM, Rantony wrote:
> Hi,
>
> Here i have a time along with date,
> for eg:-  "10/5/2012 5:05:00 AM"
>
> i need to do minus 10 minutes along current date
> Like this :- "10/5/2012 4:55:00 AM"
>
Hi Antony,
Did you get an answer for this?

oldtime<-strptime("10/5/2012 5:05:00 AM",
  format="%d/%m/%Y %I:%M:%S %p")
oldtime
[1] "2012-05-10 05:05:00"
# now subtract 10 minutes (600 seconds)
oldtime - 600
[1] "2012-05-10 04:55:00 EST"

Jim




More information about the R-help mailing list