2

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?

Ismael
  • 30,570
  • 21
  • 53
  • 96
Nova Lova
  • 41
  • 1
  • 3
  • Can you indicate the function you use to get the date in solidity ? Or have a look at https://ethereum.stackexchange.com/questions/9858/solidity-is-there-a-way-to-get-the-timestamp-of-a-transaction-that-executed – Nicolas Massart Sep 24 '18 at 10:37

2 Answers2

2

Yes, it is GMT+0 or UTC.

According to Ethereum Yellow Paper the timestamp in a block is a unix timestamp.

timestamp: A scalar value equal to the reasonable output of Unix’s time() at this block’s inception; formally Hs.

Now from wikipedia

Unix time (also known as POSIX time or UNIX Epoch time) is a system for describing a point in time, defined as an approximation of the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970.

Ismael
  • 30,570
  • 21
  • 53
  • 96
0

block.timestamp

From Solidity docs

block.timestamp (uint): current block timestamp as seconds since unix epoch

It's a UNIX timestamp. Also now is an alias for block.timestamp.


A few things to keep in mind:

I need to know what is time zone is the transaction date in Solidity

You only get the block timestamp, not the transaction timestamp.

a lotery with one game per day

Miners (esp. mining pools) can potentially adjust the timestamp as they mine, so you should design your lottery in a way that it's not entirely timestamp dependent.

libertylocked
  • 1,368
  • 8
  • 16