0

I want to keep track of each nft count per year. so I need to get the year part of current timestamp.

mapping(uint256 => mapping(uint256 => uint256)) public mintCountPerYear;

this dictionary will hold the nft-id and in the value there will be year and count

1 Answer 1

2

That would be

Uint currentYear = (block.timestamp / 31557600) + 1970; 

Assuming that a year is 365,25 days (to account for leap years) and a day is 86400 seconds (which isnt always the case). Im pretty sure thats the best you can get though.

0

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.