[Ethereum] Is the block.timestamp value in Solidity seconds or milliseconds

soliditytimestamp

I'm looking to use block.timestamp in one of my contracts and I want to know whether the block.timestamp is seconds like in Python or milliseconds like in Java or some other value?

Also, is it safe to use block.timestamp to check if 30 days is past since the last updated time or something like that?

Best Answer

From the Solidity documentation (here and here):

... timestamp of the current block in seconds since the epoch

For your other question:

Also, is it safe to use block.timestamp to check if 30 days is past since the last updated time or something like that?

Your question isn't completely clear, but assuming you're questioning the validity of a timestamp over a given period of time, then this previous answer should cover it: Is block.timestamp safe for longer time periods?

Related Topic