2

Solidity has keywords like seconds, minutes, hours, days and weeks that are used to specify units of time.

Why do they not have years?

1 Answer 1

1

Solidity had the year keyword in all versions prior to 0.5.0. It was removed due to complications and confusions about leap years.

From the Time Units section of the docs:

Take care if you perform calendar calculations using these units, because not every year equals 365 days and not even every day has 24 hours because of leap seconds. Due to the fact that leap seconds cannot be predicted, an exact calendar library has to be updated by an external oracle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.