Convert an R object to a datetime object that can be used in a WHERE clause.

to.db.datetime(val, origin = "1970-01-01")