toTimestamp(timeStamp)
Use the fromTimestamp()
and toTimestamp()
functions to search for transactions by timestamp. Results returned are >= fromTimestamp
and < toTimestamp
.
Parameters
timeStamp
: Timestamp as Date object or UNIX timestamp in milliseconds
You can search by passing Date
objects to the functions:
const results = await myQuery
.search("irys:transactions")
.fromTimestamp(new Date("2023-07-01"))
.toTimestamp(new Date("2023-07-03"));
Or by using UNIX timestamps in millisecond format:
const results = await myQuery
.search("irys:transactions")
.fromTimestamp(1688144401000)
.toTimestamp(1688317201000);
ℹ️
Irys timestamps are accurate to the millisecond, so you need to provide a timestamp in millisecond format. You can convert from human-readable time to UNIX timestamp using websites like Epoch101 (opens in a new tab), be sure to convert in millisecond format, not second.