Happy Valentine’s Day fellow nerds! This year for Valentine’s Day I want to mint my gf a valentine NFT. Since I’m building it I want to turn it into an NFT project that is free to mint for the public on Valentine’s Day only.

I’m trying to figure out how to do this using UNIX time but can’t think of a good solution without modelling the calendar year and leap years and such into my calculations.

Any libraries or solutions to check the following condition? ‘’’if (monthOf(timestamp) == 2 && dayOf(timestamp) == 14) mintValentine(msg.sender);’’’

1 Answer 1


I know about this library here: https://github.com/bokkypoobah/BokkyPooBahsDateTimeLibrary

There are instructions in the README. In any case it's very simple, you can just copy the library into your contract and use the timestampToDate(block.timestamp) function to get the current day and month.

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.