Skip to main content
deleted 7 characters in body
Source Link
Badr Bellaj
  • 18.8k
  • 4
  • 59
  • 75

A transaction doesn't have a timestamp. However, every block provides a timestamp (when it was collected), but if the time is critical for you, don't refer to this timestamp because a miner could modify it by about 900s. Instead, you could use block.number.

1- current block timestamp is returned by now:

e.g.

contract Test {
    function Time_call() returns (uint256){
        return now;
    }
}

Time_call() will return something like 1478431966 (which you could convert into a readable form in https://www.unixtimestamp.com/).

2- block number is returned using block.number:

 function Time_call() returns (uint256){
        return block.number; 
    }

to get the call time, you could use the block.number and the block time (an average).

Edit: if you want when the transaction was sent, use JavaScript in your Dapp to get the current time var seconds = new Date().getTime() / 1000;; and send it in the data field within your transaction.

A transaction doesn't have a timestamp. However, every block provides a timestamp (when it was collected), but if the time is critical for you, don't refer to this timestamp because a miner could modify it by about 900s. Instead, you could use block.number.

1- current block timestamp is returned by now:

e.g.

contract Test {
    function Time_call() returns (uint256){
        return now;
    }
}

Time_call() will return something like 1478431966 (which you could convert into a readable form in https://www.unixtimestamp.com/).

2- block number is returned using block.number:

 function Time_call() returns (uint256){
        return block.number; 
    }

to get the call time, you could use the block.number and the block time (an average).

Edit: if you want when the transaction was sent, use JavaScript in your Dapp to get the current time var seconds = new Date().getTime() / 1000; and send it in the data field within your transaction.

A transaction doesn't have a timestamp. However, every block provides a timestamp (when it was collected), but if the time is critical for you, don't refer to this timestamp because a miner could modify it by about 900s. Instead, you could use block.number.

1- current block timestamp is returned by now:

e.g.

contract Test {
    function Time_call() returns (uint256){
        return now;
    }
}

Time_call() will return something like 1478431966 (which you could convert into a readable form in https://www.unixtimestamp.com/).

2- block number is returned using block.number:

 function Time_call() returns (uint256){
        return block.number; 
    }

to get the call time, you could use the block.number and the block time (an average).

Edit: if you want when the transaction was sent, use JavaScript in your Dapp to get the current time var seconds = new Date().getTime(); and send it in the data field within your transaction.

Improve spelling, grammar, capitalization, wording, formatting, punctuation. Fix dead link. Turn http link into https.
Source Link

A Transactiontransaction doesn't have a timestamp. However, Everyevery block provides a timestamp  (when it was collected), but if the time is critical for you, don't refer to this timestamp because a miner could modify it by about 900s. Instead, you could use instead block.number.

1- current block timestamp is returned by now now:

e.g.

contract Test {
    function Time_call() returns (uint256){
        return now;
    }
}

Time_callTime_call() will returnsreturn something like : 14784319661478431966 (which you could convert ininto a readblereadable form in http://www.unixtimestamp.com/https://www.unixtimestamp.com/).

2- block Numbernumber is returned using block.numberblock.number:

 function Time_call() returns (uint256){
        return block.number; 
    }

to get the call time, you could use the block.numberblock.number and the block timeblock time (an avarageaverage).

Edit: if you want when the transaction was sent, use javascriptJavaScript in your Dapp to get the current time var seconds = new Date().getTime() / 1000; and send it in the data field withingwithin your transaction.

A Transaction doesn't have a timestamp. However, Every block provides a timestamp(when it was collected), but if the time is critical for you don't refer to this timestamp because a miner could modify it by about 900s you could use instead block.number.

1- current block timestamp is returned by now :

e.g

contract Test {
    function Time_call() returns (uint256){
        return now;
    }
}

Time_call will returns something like : 1478431966 (which you could convert in a readble form in http://www.unixtimestamp.com/)

2- block Number is returned using block.number

 function Time_call() returns (uint256){
        return block.number; 
    }

to get the call time you could use the block.number and the block time (an avarage)

Edit: if you want when the transaction was sent use javascript in your Dapp to get the current time var seconds = new Date().getTime() / 1000; and send it in the data field withing your transaction.

A transaction doesn't have a timestamp. However, every block provides a timestamp  (when it was collected), but if the time is critical for you, don't refer to this timestamp because a miner could modify it by about 900s. Instead, you could use block.number.

1- current block timestamp is returned by now:

e.g.

contract Test {
    function Time_call() returns (uint256){
        return now;
    }
}

Time_call() will return something like 1478431966 (which you could convert into a readable form in https://www.unixtimestamp.com/).

2- block number is returned using block.number:

 function Time_call() returns (uint256){
        return block.number; 
    }

to get the call time, you could use the block.number and the block time (an average).

Edit: if you want when the transaction was sent, use JavaScript in your Dapp to get the current time var seconds = new Date().getTime() / 1000; and send it in the data field within your transaction.

added 73 characters in body
Source Link
Badr Bellaj
  • 18.8k
  • 4
  • 59
  • 75

A Transaction doesn't have a timestamp. However, Every block provideprovides a timestamp(when it was collected), but if the time is critical for you don't refer to this timestamp because a miner could modify it by about 900s you could use instead block.number.

1- current block timestamp is returned by now :

e.g

contract Test {
    function Time_call() returns (uint256){
        return now;
    }
}

Time_call will returns something like : 1478431966 (which you could convert in a readble form in http://www.unixtimestamp.com/)

2- block Number is returned using block.number

 function Time_call() returns (uint256){
        return block.number; 
    }

to get the call time you could use the block.number and the block time (an avarage)

Edit: if you want when the transaction was sent use javascript in your Dapp to get the current time var seconds = new Date().getTime() / 1000; and send it in the data field withing your transaction.

Every block provide a timestamp, but if the time is critical for you don't refer to this timestamp because a miner could modify it by about 900s you could use instead block.number.

1- current block timestamp is returned by now :

e.g

contract Test {
    function Time_call() returns (uint256){
        return now;
    }
}

Time_call will returns something like : 1478431966 (which you could convert in a readble form in http://www.unixtimestamp.com/)

2- block Number is returned using block.number

 function Time_call() returns (uint256){
        return block.number; 
    }

to get the call time you could use the block.number and the block time (an avarage)

Edit: if you want when the transaction was sent use javascript in your Dapp to get the current time var seconds = new Date().getTime() / 1000; and send it in the data field withing your transaction.

A Transaction doesn't have a timestamp. However, Every block provides a timestamp(when it was collected), but if the time is critical for you don't refer to this timestamp because a miner could modify it by about 900s you could use instead block.number.

1- current block timestamp is returned by now :

e.g

contract Test {
    function Time_call() returns (uint256){
        return now;
    }
}

Time_call will returns something like : 1478431966 (which you could convert in a readble form in http://www.unixtimestamp.com/)

2- block Number is returned using block.number

 function Time_call() returns (uint256){
        return block.number; 
    }

to get the call time you could use the block.number and the block time (an avarage)

Edit: if you want when the transaction was sent use javascript in your Dapp to get the current time var seconds = new Date().getTime() / 1000; and send it in the data field withing your transaction.

added 206 characters in body
Source Link
Badr Bellaj
  • 18.8k
  • 4
  • 59
  • 75
Loading
added 175 characters in body
Source Link
Badr Bellaj
  • 18.8k
  • 4
  • 59
  • 75
Loading
Source Link
Badr Bellaj
  • 18.8k
  • 4
  • 59
  • 75
Loading