How to compare datetime in r?

That value is a character string, not a "Date Time" object, see this example:

# This is a "character" string
class("2020-05-20 14:00:00")
#> [1] "character"

# This is a "Date Time" object
class(as.POSIXct("2020-05-20 14:00:00"))
#> [1] "POSIXct" "POSIXt"

Created on 2020-05-26 by the reprex package (v0.3.0)

If you need more specific help, please provide a proper REPRoducible EXample (reprex) illustrating your issue.