I want to run a function after every 365 days in Solidity. I have tried to use the now keyword, but it is not working (I tried in Remix).
How can I get the time?
I want to run a function after every 365 days in Solidity. I have tried to use the now keyword, but it is not working (I tried in Remix).
How can I get the time?
You can use any of the built-in Solidity time units.
For example, you can do:
function f(uint start) public {
if (block.timestamp >= start + 365 days) {
// ...
}
}