DateTime

Git Source

Considers leap year, but not leap second.

Note: https://github.com/pipermerriam/ethereum-datetime/blob/master/contracts/contracts/DateTime.sol

State Variables

ORIGIN_YEAR

uint16 private constant ORIGIN_YEAR = 1970;

Functions

isLeapYear

function isLeapYear(uint16 year) internal pure returns (bool);

toTimestamp

Convert year, month, day, hour, minute, second to Unix timestamp.

Leap second is not supported.

function toTimestamp(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute, uint8 second)
    internal
    pure
    returns (uint256 timestamp);