0

When using R how can I subtract a number of days from a date-time with clock time written in the following way: 2013-06-13 08:24:00.

E.g. subtract one day from 2013-06-13 08:24:00 to obtain 2013-06-12 08:24:00.

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418
beginner
  • 19
  • 2

1 Answers1

3
library(lubridate)
x <- as.POSIXct("2013-06-13 08:24:00")

x - ddays(1) - dminutes(24)
#[1] "2013-06-12 08:00:00 EEST"
gd047
  • 29,749
  • 18
  • 107
  • 146