I have a data set that has two columns: the first is named 'key' and contains datetime (though currently in the form of a character), and the second contains more datetime values. I'd like to use spread to make the key rows become column names. Kind of complicated but once that is done I will convert the tibble to a list and use it with another function to create schedules that are named by the datetime column heading.
The data looks like this now:
new_dat <- structure(list(key = c("2018-01-01 01:00:00", "2018-01-01 01:00:00",
"2018-01-01 01:00:00", "2018-01-01 01:00:00", "2018-01-01 01:00:00",
"2018-01-02 01:00:00", "2018-01-02 01:00:00", "2018-01-02 01:00:00",
"2018-01-02 01:00:00", "2018-01-02 01:00:00", "2018-01-03 01:00:00",
"2018-01-03 01:00:00", "2018-01-03 01:00:00", "2018-01-03 01:00:00",
"2018-01-03 01:00:00"), value = structure(c(1514835600, 1514920800,
1515013380, 1515100860, 1515173100, 1514925060, 1514994060, 1515088920,
1515181020, 1515271740, 1515011880, 1515079200, 1515174240, 1515256980,
1515345600), class = c("POSIXct", "POSIXt"), tzone = "America/Boise")), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -15L), .Names = c("key",
"value"))
And I want it to look something like this:
A tibble: 7,201 x 3
`2018-01-01 01:00:00` `2018-01-02 01:00:00` `2018-01-03 01:00:00`
<dttm> <dttm> <dttm>
2018-01-01 01:00:00 2018-01-02 01:00:00 2018-01-03 01:00:00
I used spread() and got the following error:
Error in eval_tidy(enquo(var), var_env) : object '' not found
Is it possible to make a datetime a column name with spread()?
We need a sequence column as there are duplicate records
library(tidyverse)
new_dat %>%
group_by(key) %>%
mutate(rn = row_number()) %>%
spread(key, value) %>%
select(-rn)
# A tibble: 5 x 3
# `2018-01-01 01:00:00` `2018-01-02 01:00:00` `2018-01-03 01:00:00`
# <dttm> <dttm> <dttm>
#1 2018-01-01 12:40:00 2018-01-02 13:31:00 2018-01-03 13:38:00
#2 2018-01-02 12:20:00 2018-01-03 08:41:00 2018-01-04 08:20:00
#3 2018-01-03 14:03:00 2018-01-04 11:02:00 2018-01-05 10:44:00
#4 2018-01-04 14:21:00 2018-01-05 12:37:00 2018-01-06 09:43:00
#5 2018-01-05 10:25:00 2018-01-06 13:49:00 2018-01-07 10:20:00
Related
Not even sure if I've described the problem accurately in the title, but here goes.
Suppose I have the following data.table/data.frame:
library(data.table)
library(lubridate)
DT <- data.table(begin = c("2019-06-01 09:00:00","2019-06-01 09:00:00", "2019-06-01 09:00:00",
"2019-06-01 09:00:00", "2016-06-01 09:00:00","2016-06-01 09:00:00"),
end = c("2019-06-03 14:00:00", "2019-06-03 14:00:00", "2019-06-03 14:00:00",
"2019-06-02 05:00:00", "2019-06-02 05:00:00", "2016-06-01 23:15:00"),
person = c("A", "A","A", "B", "B", "C"))
begin end person
1: 2019-06-01 09:00:00 2019-06-03 14:00:00 A
2: 2019-06-01 09:00:00 2019-06-03 14:00:00 A
3: 2019-06-01 09:00:00 2019-06-03 14:00:00 A
4: 2019-06-01 09:00:00 2019-06-02 05:00:00 B
5: 2016-06-01 09:00:00 2019-06-02 05:00:00 B
6: 2016-06-01 09:00:00 2016-06-01 23:15:00 C
This is essentially a dataset summarizing time stamps of when a period began and ended for each person. The number of rows are repeated for each person by the number of days which the time period spans. For example, person A has three entries for the same "shift" because their shift spans three distinct dates, 06-01, 06-02, and 06-03. The entries are repeated by the number of dates which the shifts span, but some shifts begin and end within the same day.
What I want is to update the begin and end dates of the above dataset, so that I can see what time each shift began and ended at the day level. So the dataset should look like:
begin end person
1: 2019-06-01 09:00:00 2019-06-02 00:00:00 A
2: 2019-06-02 00:00:00 2019-06-03 00:00:00 A
3: 2019-06-03 00:00:00 2019-06-03 14:00:00 A
4: 2019-06-01 09:00:00 2019-06-02 00:00:00 B
5: 2016-06-02 00:00:00 2019-06-02 05:00:00 B
6: 2016-06-01 09:00:00 2016-06-01 23:15:00 C
Any help would be greatly appreciated!
First, fixing the dates (and I already fixed row 5's starting in 2016 and going through to 2019, seems unlikely),
DT[, c("begin", "end"):=lapply(.SD, as.POSIXct), .SDcols=c("begin", "end")]
## we get this
DT <- as.data.table(structure(list(begin = structure(c(1559394000, 1559394000, 1559394000, 1559394000, 1559394000, 1464786000), class = c("POSIXct", "POSIXt"), tzone = ""), end = structure(c(1559584800, 1559584800, 1559584800, 1559466000, 1559466000, 1464837300), class = c("POSIXct", "POSIXt"), tzone = ""), person = c("A", "A", "A", "B", "B", "C")), row.names = c(NA, -6L), class = c("data.table", "data.frame")))
Second, we then create this function
func <- function(st, en) {
midns <- lubridate::ceiling_date(seq(st, en, by = "day"), unit = "day")
times <- unique(sort(c(midns[ st < midns & midns < en], st, en)))
data.table(begin = times[-length(times)], end = times[-1])
}
Lastly, we use it, using by=.(person) to preserve that column in the output. I use DT since we do not need (or even want) duplicates for each shift/day:
unique(DT)[, rbindlist(Map(func, begin, end)), by = .(person)]
# person begin end
# <char> <POSc> <POSc>
# 1: A 2019-06-01 09:00:00 2019-06-02 00:00:00
# 2: A 2019-06-02 00:00:00 2019-06-03 00:00:00
# 3: A 2019-06-03 00:00:00 2019-06-03 14:00:00
# 4: B 2019-06-01 09:00:00 2019-06-02 00:00:00
# 5: B 2019-06-02 00:00:00 2019-06-02 05:00:00
# 6: C 2016-06-01 09:00:00 2016-06-01 23:15:00
Assuming you had a typo for row 5 person B (begin 2019 not 2016):
library(data.table)
library(lubridate)
> DT <- data.table(begin = c("2019-06-01 09:00:00","2019-06-01 09:00:00", "2019-06-01 09:00:00",
+ "2019-06-01 09:00:00", "2019-06-01 09:00:00","2016-06-01 09:00:00"),
+ end = c("2019-06-03 14:00:00", "2019-06-03 14:00:00", "2019-06-03 14:00:00",
+ "2019-06-02 05:00:00", "2019-06-02 05:00:00", "2016-06-01 23:15:00"),
+ person = c("A", "A","A", "B", "B", "C"))
>
> DT[, `:=`(min=as.numeric(difftime(end,begin, units="mins")),
+ days=as.numeric(as_date(end)-as_date(begin)+1))][, min_day:=min/days]
>
> unique(DT)
begin end person min days min_day
1: 2019-06-01 09:00:00 2019-06-03 14:00:00 A 3180 3 1060
2: 2019-06-01 09:00:00 2019-06-02 05:00:00 B 1200 2 600
3: 2016-06-01 09:00:00 2016-06-01 23:15:00 C 855 1 855
Im strugling to aggregate hourly temperatures into 3-hourly while keeping the station ID.Here is the df:
ID
Date
temp
1155
2012-01-01 00:00:00
-0.8
1155
2012-01-01 01:00:00
0.1
1155
2012-01-01 02:00:00
0.5
and Im striving to get smth like:
ID
Date
temp
1155
2012-01-01
-0.2
Ive elaborated this code:
library(dplyr)
Temp_3h<- df %>%
group_by(ID)%>%
aggregate(.,by=list(Date=cut(as.POSIXct(df$Date), "3 hour")),mean)
but beside the "temp" variable it also tend to aggregate IDs (categorical), so they become NAs. And I dont know how to integrate ID into "by=" argument. Any help would be appreciated
You may use floor_date/ceiling_date to combine timestamp every 3 hours into one and take average of temp values for each ID.
library(dplyr)
library(lubridate)
Temp_3h <- df %>%
group_by(ID, Date = floor_date(ymd_hms(Date), '3 hours')) %>%
summarise(temp = mean(temp, na.rm = TRUE), .groups = 'drop')
Temp_3h
I actually like the cut approach.
d |>
transform(date_s=cut(as.POSIXct(d$Date), breaks="3 hours")) |>
with(aggregate(list(mn_temp=temp), list(date=date_s, ID=ID), FUN=mean))
# date ID mn_temp
# 1 2012-01-01 00:00:00 1155 -0.06666667
# 2 2012-01-01 03:00:00 1155 0.56666667
# 3 2012-01-01 06:00:00 1155 0.93333333
# 4 2012-01-01 09:00:00 1155 3.70000000
If instead of the start time we rather want to display the end of the time interval, we could do
d |>
transform(date_s=cut(
as.POSIXct(d$Date), breaks="3 hours",
labels=(as.POSIXct(Date) + 10800)[(seq(Date) - 1) %% 3 == 0])) |>
with(aggregate(list(mn_temp_lst3=temp), list(date=date_s, ID=ID), FUN=mean))
# date ID mn_temp_lst3
# 1 2012-01-01 03:00:00 1155 -0.06666667
# 2 2012-01-01 06:00:00 1155 0.56666667
# 3 2012-01-01 09:00:00 1155 0.93333333
# 4 2012-01-01 12:00:00 1155 3.70000000
Data
d <- structure(list(ID = c(1155L, 1155L, 1155L, 1155L, 1155L, 1155L,
1155L, 1155L, 1155L, 1155L), Date = c("2012-01-01 00:00:00",
"2012-01-01 01:00:00", "2012-01-01 02:00:00", "2012-01-01 03:00:00",
"2012-01-01 04:00:00", "2012-01-01 05:00:00", "2012-01-01 06:00:00",
"2012-01-01 07:00:00", "2012-01-01 08:00:00", "2012-01-01 09:00:00"
), temp = c(-0.8, 0.1, 0.5, 0.6, 0.6, 0.5, 0.7, 0.9, 1.2, 3.7
)), row.names = c(NA, -10L), class = "data.frame")
You could floor the dates and use the group_by and summarize functions:
library(lubridate)
library(dplyr)
library(plyr)
summarise(group_by(df, ID, Date = floor_date(ymd_hms(Date), '3 hours')), first(Date), first(ID), sum(temp))
Output:
first(Date) first(ID) sum(temp)
1 2012-01-01 1155 -0.2
Using data.table
library(data.table)
library(lubridate)
setDT(df1)[, .(temp = mean(temp, na.rm = TRUE)),
.(ID, Date = floor_date(ymd_hms(Date), '3 hours'))]
How to do below task in R?
df <- tribble(
~ID, ~StartTime, ~EndTime
, 01, "2018-05-14 09:30:00", "2018-05-14 12:10:00"
, 02, "2018-05-14 21:30:00", "2018-05-15 02:00:00"
, 03, "2018-05-15 07:00:00", "2018-05-16 22:30:00"
, 04, "2018-05-16 23:00:00", "2018-05-16 23:40:00"
, 05, "2018-05-17 01:00:00", "2018-05-19 15:00:00"
)
df$StartDate <- as.POSIXlt(df$StartDate, tryFormats = "%Y-%m-%d %H:%M:%S")
df$EndDate <- as.POSIXlt(df$EndDate, tryFormats = "%Y-%m-%d %H:%M:%S")
Note: Multiple duplicate rows needs to be created from single row,
For example
Original Single row:
01, "2018-05-14 09:30:00", "2018-05-14 12:10:00"
Post processing Multiple row:
01, "2018-05-14 09:30:00", "2018-05-14 10:00:00"
01, "2018-05-14 10:00:00", "2018-05-14 11:00:00"
01, "2018-05-14 11:00:00", "2018-05-14 12:00:00"
01, "2018-05-14 12:00:00", "2018-05-14 12:10:00"
Hoping my request is clear.
We can write a function which generates an hourly sequence between two timestamps. Using map2 we call that function for every pair of StartTime and EndTime and expand the dataframe.
library(dplyr)
library(lubridate)
generate_hourly_time <- function(x, y) {
EndTime <- ceiling_date(x, 'hour')
EndTime2 <- seq(EndTime, floor_date(y, 'hour'), 'hour')
tibble(StartTime = c(x, EndTime2), EndTime = c(EndTime2, y))
}
df %>%
mutate(across(-1, ymd_hms)) %>%
#For dplyr < 1.0.0
#mutate_at(-1, ymd_hms) %>%
mutate(time = purrr::map2(StartTime, EndTime, generate_hourly_time)) %>%
select(ID, time) %>%
tidyr::unnest(time)
# A tibble: 117 x 3
# ID StartTime EndTime
# <dbl> <dttm> <dttm>
# 1 1 2018-05-14 09:30:00 2018-05-14 10:00:00
# 2 1 2018-05-14 10:00:00 2018-05-14 11:00:00
# 3 1 2018-05-14 11:00:00 2018-05-14 12:00:00
# 4 1 2018-05-14 12:00:00 2018-05-14 12:10:00
# 5 2 2018-05-14 21:30:00 2018-05-14 22:00:00
# 6 2 2018-05-14 22:00:00 2018-05-14 23:00:00
# 7 2 2018-05-14 23:00:00 2018-05-15 00:00:00
# 8 2 2018-05-15 00:00:00 2018-05-15 01:00:00
# 9 2 2018-05-15 01:00:00 2018-05-15 02:00:00
#10 2 2018-05-15 02:00:00 2018-05-15 02:00:00
# … with 107 more rows
I hope it's useful:
df <- tribble(
~ID, ~StartTime, ~EndTime
, 01, "2018-05-14 09:30:00", "2018-05-14 12:10:00"
, 01, "2018-05-14 09:30:00", "2018-05-14 12:10:00"
, 01, "2018-05-14 09:30:00", "2018-05-14 12:10:00"
, 01, "2018-05-14 09:30:00", "2018-05-14 12:10:00"
, 01, "2018-05-14 09:30:00", "2018-05-14 12:10:00"
, 02, "2018-05-14 21:30:00", "2018-05-15 02:00:00"
, 03, "2018-05-15 07:00:00", "2018-05-16 22:30:00"
, 04, "2018-05-16 23:00:00", "2018-05-16 23:40:00"
, 05, "2018-05-17 01:00:00", "2018-05-19 15:00:00"
)
nrow(df)
id.unique <- unique(df[,'ID'])
id.unique.numeric <- as.numeric(unlist(id.unique))
id.i <- id.unique.numeric
for (i in id.i) {
out.pre <- subset(df, ID==i)
name.out <- paste('df', i, '<-out.pre', sep = '')
eval(parse(text=name.out))
}
df1
FM
You could also do:
library(tidyverse)
df %>%
pivot_longer(-ID)%>%
group_by(ID)%>%
mutate(start = list(unique(c(value[1],seq(strptime(value[1],"%F %H"),
value[2],"1 hour")[-1],value[2]))),
name = NULL, value = NULL)%>%
slice(1)%>%
unnest(start)%>%
mutate(end = lead(start,1,last(start)))
# A tibble: 117 x 3
# Groups: ID [5]
ID start end
<dbl> <dttm> <dttm>
1 1 2018-05-14 09:30:00 2018-05-14 10:00:00
2 1 2018-05-14 10:00:00 2018-05-14 11:00:00
3 1 2018-05-14 11:00:00 2018-05-14 12:00:00
4 1 2018-05-14 12:00:00 2018-05-14 12:10:00
5 1 2018-05-14 12:10:00 2018-05-14 12:10:00
6 2 2018-05-14 21:30:00 2018-05-14 22:00:00
7 2 2018-05-14 22:00:00 2018-05-14 23:00:00
8 2 2018-05-14 23:00:00 2018-05-15 00:00:00
9 2 2018-05-15 00:00:00 2018-05-15 01:00:00
10 2 2018-05-15 01:00:00 2018-05-15 02:00:00
# ... with 107 more rows
I am trying to fill my data frame with dates and times that are in between a "Start_dates" and "End_dates", which are both in different columns in the data frame. I would like to do this per minute.
So for example I have a data frame like this:
data <- data.frame(id = c(1,1,1,2,3),
Start_dates = c("20-10-2016 00:00:00", "23-10-2016 00:00:00", "01-03-2018 00:00:00", "05-12-2018 00:00:00", "02-04-2016 00:00:00"),
End_dates = c("20-10-2016 00:02:00", "23-10-2016 00:01:00", "01-03-2018 00:01:00", "05-12-2018 00:02:00", "02-04-2016 00:01:00"))
I would like to get something like this:
data_requested <- data.frame(id = c(1,1,1,1,1,1,1,2,2,3,3,3),
times = c("20-10-2016 00:00:00",
"20-10-2016 00:01:00", "20-10-2016 00:02:00", "23-10-2016 00:00:00",
"23-10-2016 00:01:00", "01-03-2018 00:00:00", "01-03-2018 00:01:00",
"05-12-2018 00:00:00", "05-12-2018 00:01:00", "05-12-2018 00:02:00",
"02-04-2016 00:00:00", "02-04-2016 00:01:00"))
I tried a lot of things but it gave me either an error or not the result that I was looking for.
We convert the 'Start_dates/End_dates' to datetime, and use map2 to get the sequence
library(tidyverse)
library(lubridate)
data %>%
# convert dates to DateTime object
mutate_at(vars(ends_with('dates')), dmy_hms) %>%
# get the sequence between corresponding Start/End dates
mutate(times = map2(Start_dates, End_dates, seq, by = "1 min")) %>%
# unnest to expand the list column
unnest(times) %>%
# select the wanted columns
select(id, times)
# id times
#1 1 2016-10-20 00:00:00
#2 1 2016-10-20 00:01:00
#3 1 2016-10-20 00:02:00
#4 1 2016-10-23 00:00:00
#5 1 2016-10-23 00:01:00
#6 1 2018-03-01 00:00:00
#7 1 2018-03-01 00:01:00
#8 2 2018-12-05 00:00:00
#9 2 2018-12-05 00:01:00
#10 2 2018-12-05 00:02:00
#11 3 2016-04-02 00:00:00
#12 3 2016-04-02 00:01:00
Trying to manipulate the timestamp variable in such a way: if the start time of the following activity is before the end time of the previous activity, then update the start and end time of the previous activity as 1 second before the following activity.
Additional notes:
An activity can be repeated within the same work; i.e. the activity "A".
Some individual activities have the same start and end times some different. This is something I've done intentionally; you can ignore this.
workID workActivityID activity status timestamp timestampDesired
1 1 A start 2018-01-01 09:55:01 2018-01-01 09:54:05
1 1 A end 2018-01-01 09:55:01 2018-01-01 09:54:05
1 2 B start 2018-01-01 09:54:06 2018-01-01 09:54:06
1 2 B end 2018-01-01 09:56:22 2018-01-01 09:56:22
1 3 C start 2018-01-01 09:57:22 2018-01-01 09:57:22
1 3 C end 2018-01-01 09:57:22 2018-01-01 09:57:22
1 4 A start 2018-02-02 08:35:00 2018-02-02 08:35:00
1 4 A end 2018-02-02 08:35:00 2018-02-02 08:35:00
2 1 A start 2018-02-02 08:13:55 2018-02-02 08:14:01
2 1 A end 2018-02-02 08:14:20 2018-02-02 08:14:01
2 2 B start 2018-02-02 08:14:02 2018-02-02 08:14:02
2 2 B end 2018-02-02 08:14:50 2018-02-02 08:14:50
2 3 C start 2018-02-02 10:00:00 2018-02-02 10:00:00
2 3 C end 2018-02-02 10:00:00 2018-02-02 10:00:00
2 4 A start 2018-02-02 10:22:00 2018-02-02 10:22:00
2 4 A end 2018-02-02 10:24:00 2018-02-02 10:24:00
Data:
library(lubridate)
df <-
data.frame(
workID = rep(c(1,2), each=8),
workActivityID = rep(c(1,2,3,4), each=2, times=2),
activity = rep(c("A","B","C","A"), each=2, times=2),
startEnd = rep(c("start", "end"), times=8),
timestamp = ymd_hms(c("2018-01-01 09:55:01", "2018-01-01 09:55:01", "2018-01-01 09:54:06", "2018-01-01 09:56:22", "2018-01-01 09:57:22", "2018-01-01 09:57:22", "2018-02-02 08:35:00","2018-02-02 08:35:00",
"2018-02-02 08:13:55", "2018-02-02 08:14:20", "2018-02-02 08:14:02", "2018-02-02 08:14:50", "2018-02-02 10:00:00", "2018-02-02 10:00:00", "2018-02-02 10:22:00", "2018-02-02 10:24:00")),
timestampDesired = ymd_hms(c("2018-01-01 09:54:05", "2018-01-01 09:54:05", "2018-01-01 09:54:06", "2018-01-01 09:56:22", "2018-01-01 09:57:22", "2018-01-01 09:57:22", "2018-02-02 08:35:00", "2018-02-02 08:35:00",
"2018-02-02 08:14:01", "2018-02-02 08:14:01", "2018-02-02 08:14:02", "2018-02-02 08:14:50", "2018-02-02 10:00:00", "2018-02-02 10:00:00", "2018-02-02 10:22:00", "2018-02-02 10:24:00")))
A possible solution can be reached using tidyr::spread, tidyr::gather. The approach is simple in the sense that move start and end in same row so that decision and change operation (if needed) will be easier. Once modification is performed change it back to long format.
library(tidyverse)
df %>% select(-timestampDesired) %>%
spread(startEnd, timestamp) %>%
group_by(workID) %>%
mutate(start = as.POSIXct(ifelse(!is.na(lead(start)) & lead(start) < end,
lead(start) - 1, start), origin = "1970-01-01 00:00:00" )) %>%
mutate(end = as.POSIXct(ifelse(!is.na(lead(start)) & lead(start) < end,
lead(start) - 1, end), origin = "1970-01-01 00:00:00" )) %>%
ungroup() %>%
gather("startEnd", "timestamp", c("start","end")) %>%
arrange(workID, workActivityID, desc(startEnd)) %>%
as.data.frame()
# workID workActivityID activity startEnd timestamp
# 1 1 1 A start 2018-01-01 09:54:05
# 2 1 1 A end 2018-01-01 09:54:05
# 3 1 2 B start 2018-01-01 09:54:06
# 4 1 2 B end 2018-01-01 09:56:22
# 5 1 3 C start 2018-01-01 09:57:22
# 6 1 3 C end 2018-01-01 09:57:22
# 7 1 4 A start 2018-02-02 08:35:00
# 8 1 4 A end 2018-02-02 08:35:00
# 9 2 1 A start 2018-02-02 08:14:01
# 10 2 1 A end 2018-02-02 08:14:01
# 11 2 2 B start 2018-02-02 08:14:02
# 12 2 2 B end 2018-02-02 08:14:50
# 13 2 3 C start 2018-02-02 10:00:00
# 14 2 3 C end 2018-02-02 10:00:00
# 15 2 4 A start 2018-02-02 10:22:00
# 16 2 4 A end 2018-02-02 10:24:00
Just posting a data.table solution. Explanation inline
#cast into a wide format
wideDT <- dcast.data.table(DT, ... ~ startEnd, value.var="timestamp")
#lead the start time vector and compare start time and amend start and end time if required
wideDT[, c("newstart", "newend") := {
x <- shift(start, type="lead", fill=max(end))
list(newstart=as.POSIXct(ifelse(x < end, x - 1, start), origin="1970-01-01"),
newend=as.POSIXct(ifelse(x < end, x - 1, end), origin="1970-01-01"))
}, by=.(workID)]
#get OP's desired output
wideDT[.(workID, workActivityID, activity),
list(startend=c("start", "end"),
timestamp=c(start, end),
timestampDesired=c(newstart, newend)), by=.EACHI]
data:
library(data.table)
DT <- data.table(
workID = rep(c(1,2), each=8),
workActivityID = rep(c(1,2,3,4), each=2, times=2),
activity = rep(c("A","B","C","A"), each=2, times=2),
startEnd = rep(c("start", "end"), times=8),
timestamp = as.POSIXct(c("2018-01-01 09:55:01", "2018-01-01 09:55:01", "2018-01-01 09:54:06", "2018-01-01 09:56:22", "2018-01-01 09:57:22", "2018-01-01 09:57:22", "2018-02-02 08:35:00","2018-02-02 08:35:00",
"2018-02-02 08:13:55", "2018-02-02 08:14:20", "2018-02-02 08:14:02", "2018-02-02 08:14:50", "2018-02-02 10:00:00", "2018-02-02 10:00:00", "2018-02-02 10:22:00", "2018-02-02 10:24:00")))