1. The time unit of sodidity
Solidity has a total of 6 time units: seconds, minutes, hours, days, weeks, and years. When converting between each time unit, Solidity's time conversion does not take leap years and leap months into consideration, so the time conversion is not very accurate.
The following is the relationship between the various time units

2. How to get the current time
The current timestamp can be obtained through the timestamp attribute in the bolck object block.timestamp;
3. How to achieve execution only once a day?
The implementation idea is to keep the last execution time, and compare each execution time with the last execution time. If it is greater than one day, it can be executed. The code is as follows
4. Try to use solidity time-related third-party libraries
Solidity also has a time library similar to PHP Carbon. I use the DateTime library. From Github, it has not been updated for six years. It can still be used with simple modifications. This library encapsulates some shortcut methods for obtaining the current time, which is very convenient. You can quickly obtain the current year, month, day, etc.
If you think this article is helpful, please give me a thumbs up~ 😁