All the documentation says this should be possible:
(def db (d/db conn))
=> #'datomic-demo.entry/db
(def new-db (d/as-of db (java.util.Date.)))
=> #'datomic-demo.entry/new-db
(d/pull new-db '[*] 17592186045421)
Execution error (ExceptionInfo) at datomic.client.api.async/ares (async.clj:58).
class java.util.Date cannot be cast to class datomic.db.IDb (java.util.Date is in module java.base of loader 'bootstrap'; datomic.db.IDb is in unnamed module of loader 'app')
I also tried using #inst and some of the java.time.* but this gives the same error.