Questions tagged [datetime]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
15 views

timeintervals in Solidity [duplicate]

Is there a way to do something at each time interval in solidity without having to write and sign a transaction (paying gas) each time the interval passed. For example. Say I have a glass of eWater on ...
user avatar
0 votes
1 answer
18 views

How to get current Year from timestamp (solidity)

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 ...
user avatar
1 vote
1 answer
16 views

How to check if an amount is stacked on contract more than a one days

I have following struct on my contract : struct Token { address tokenAddress; uint256 stakedAmount; bool isUsed; uint256 lastTransactionDate; } It is used on ...
user avatar
  • 157
0 votes
1 answer
22 views

compare uint from datestamp always return true

function testDate(uint date1,uint date2) public returns (bool) { require(date1 == date2,'not same date') return date1 == date2; } let res = await TestSol.testDate.call(‘1630972800’,‘1631145600’)...
user avatar
0 votes
1 answer
46 views

I need to understand a line of code inside a contract => startTime: _startTime == 0 ? currentTime() : _startTime

I am reading a contract from this location : https://gist.github.com/rstormsf/7cfb0c6b7a835c0c67b4a394b4fd9383 I am not able to understand the logic in the code line 72 startTime: _startTime == 0 ? ...
user avatar
0 votes
1 answer
2k views

Solidity: Is there any way to store the start time of solidity code? now() function returns block.timestamp only

I wanted to get a start time of solidity code, so I used now() previous which only returns block.timestamp whenever the solidity got started. Is there any way to store or know the start time of ...
user avatar
  • 73
1 vote
0 answers
25 views

How can I specify a date picker in one of the fields in my ContractForm React component?

I'm using the ContractForm React component available in the drizzle-react-component library. It's super nice and easy to setup and use, but I am dealing with a date in one of the fields (which is ...
user avatar
  • 123
0 votes
1 answer
311 views

is it possible triggering a contract on specific date? [duplicate]

Can I trigger a smart contract on specific date? If I deploy a contract today and I want execute some function of that contract tomorrow without any exteral intervention. Is it possible?
user avatar
0 votes
1 answer
190 views

Conversion from calendar format into timestamp format

I see a lot of discussion about date and time, timestamp... But they don't answer to my question: How can i convert from calendar format into timestamp format for comparing datetime? e.g: I have this ...
user avatar
5 votes
1 answer
326 views

Timestamp in Ethereum

I have a smart contract where the user inputs temperature readings, I'd like to add a time stamp to relate those reading with a current time of submission. I understand that in Ethereum we only have ...
user avatar
  • 139
1 vote
1 answer
268 views

Dates of ERC20 tokens transactions

I'm an individual who is interested to ICOs which are selling ERC20 tokens. My question is related to an issue that, for most of the ERC20 tokens, the dates of transactions do not fall within the ICO ...
user avatar
5 votes
1 answer
4k views

What is the time zone of the Ethereum block chain?

In Solidty, you can use now keyword or block.timestamp to get the timestamp of the current block. This value, which is set by the block miner, can be used to work with time in your smart contract (...
user avatar
1 vote
1 answer
489 views

how to get input of time in solidity?

I want to run a session for a product in auction , my product struct contains the time interval we need for being the session of the bidding. While initializing a product, I need to take the input of ...
user avatar
1 vote
1 answer
51 views

Is there any protection in the Ethereum consensus or network protocol to avoid a block being mined with a timestamp 1000 years ahead of UTC time? [duplicate]

Will other nodes refuse the mined block if the timestamp is too far apart from local or UTC timestamp or will they blindely accept the block if the PoW is correct?
user avatar
  • 526
0 votes
2 answers
292 views

Periodic time calculation oracle needed

I want to make a calculation with the blockchain every day at the same hour. Iknow every miners got his own time. I think i had to find an oracle. Any idea ?
user avatar
2 votes
2 answers
98 views

Reference of a transaction date [closed]

I am building a lotery with one game per day on Ethereum but I need to know what is time zone is the transaction date in Solidity. Is it gmt+0?
user avatar
5 votes
1 answer
1k views

Setting time requirements in Solidity

I want a function to only be able to be called after a certain specific period of time has passed from the contract's inception. Generally, I was using block.number for that. As in: require(block....
user avatar
4 votes
1 answer
4k views

How Can I Convert Between A Solidity Timestamp And Year/Month/Day Hour:Minute:Second?

Solidity provides the uint256 now or block.timestamp Special Variable. How can I convert between this Solidity timestamp and year/month/day hour:minute:second?
user avatar