as.POSIXct format i want to use sqldf

I have a data set: which include as.POSIXct and integer numbers. I want to use sql to secelect some data between two datetime: however, it seemed that the condition didn't work in r:

test1 <- sqldf("select *, (case when time between '20170530 00:00:00' and '20170530 03:00:00' then 1 else 0 end) as newdata from olddata")

The data type show in R is [1] "POSIXct" "POSIXt" . Attached example data below and can anyone help with it?

2017/5/25 04:00:00	11586
2017/5/30 04:00:00	11834
2017/5/28 04:00:00	11909
2017/5/30 03:00:00	11962
2017/5/30 01:00:00	12500