Time Units in Solidity
There are 5 valid time units in Solidity. These are seconds, minutes, hours, days, and weeks.
- The time unit years have been removed from Solidity versions 0.5.0 and above since a year can have either 365 or 366 days(in case of leap year) and hence to avoid ambiguity the suffix was deprecated.
- Since a month can have 28, 29, 30, or 31 days, there is no such unit for months in Solidity.
1 seconds == 1 seconds
1 minutes == 60 seconds
1 hours == 60 minutes == 3600 seconds
1 days == 24 hours == 86400 seconds
1 weeks == 7 days == 604800 seconds
Time Units in Solidity
Solidity is a programming language to write smart contracts on the Ethereum blockchain. Precise timings have an important role to play in smart contracts since on many occasions it has to ensure the execution of the code based on conditions that include time constraints.
Solidity has provided developers with many time units which are used as suffixes for better code readability and can be used to denote various time duration.