I have got some transactions which takes date as a parameter. When doing getPastEvents, is there any way to pass a date range in filter tab like below:
startDate: 10-03-2019 endDate: 30-03-2019
Thank you in advance.
The reason why dates aren't reliable in a blockchain is that there is a lack of global clock.
It is one of the main topics in distributed computing.
Anyway back to your original question and how can you achieve it:
I'd suggest you to track blocks and it's timestamps and store it somewhere (db or even a file, your choice) You can do that by using getBlock function.
So you'll know your fromBlock
& toBlock
to query using getPastEvents
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.