BokkyPooBahsDateTimeLibrary.sol

View Source: contracts/libraries/BokkyPooBahsDateTimeLibrary.sol

BokkyPooBahsDateTimeLibrary

Contract Members

Constants & Variables

uint256 internal constant SECONDS_PER_DAY;
uint256 internal constant SECONDS_PER_HOUR;
uint256 internal constant SECONDS_PER_MINUTE;
int256 internal constant OFFSET19700101;
uint256 internal constant DOW_MON;
uint256 internal constant DOW_TUE;
uint256 internal constant DOW_WED;
uint256 internal constant DOW_THU;
uint256 internal constant DOW_FRI;
uint256 internal constant DOW_SAT;
uint256 internal constant DOW_SUN;

Functions

_daysFromDate

function _daysFromDate(uint256 year, uint256 month, uint256 day) internal pure
returns(_days uint256)

Arguments

Name

Type

Description

year

uint256

month

uint256

day

uint256

_daysToDate

function _daysToDate(uint256 _days) internal pure
returns(year uint256, month uint256, day uint256)

Arguments

Name

Type

Description

_days

uint256

timestampFromDate

function timestampFromDate(uint256 year, uint256 month, uint256 day) internal pure
returns(timestamp uint256)

Arguments

Name

Type

Description

year

uint256

month

uint256

day

uint256

timestampFromDateTime

function timestampFromDateTime(uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second) internal pure
returns(timestamp uint256)

Arguments

Name

Type

Description

year

uint256

month

uint256

day

uint256

hour

uint256

minute

uint256

second

uint256

timestampToDate

function timestampToDate(uint256 timestamp) internal pure
returns(year uint256, month uint256, day uint256)

Arguments

Name

Type

Description

timestamp

uint256

timestampToDateTime

function timestampToDateTime(uint256 timestamp) internal pure
returns(year uint256, month uint256, day uint256, hour uint256, minute uint256, second uint256)

Arguments

Name

Type

Description

timestamp

uint256

isValidDate

function isValidDate(uint256 year, uint256 month, uint256 day) internal pure
returns(valid bool)

Arguments

Name

Type

Description

year

uint256

month

uint256

day

uint256

isValidDateTime

function isValidDateTime(uint256 year, uint256 month, uint256 day, uint256 hour, uint256 minute, uint256 second) internal pure
returns(valid bool)

Arguments

Name

Type

Description

year

uint256

month

uint256

day

uint256

hour

uint256

minute

uint256

second

uint256

isLeapYear

function isLeapYear(uint256 timestamp) internal pure
returns(leapYear bool)

Arguments

Name

Type

Description

timestamp

uint256

_isLeapYear

function _isLeapYear(uint256 year) internal pure
returns(leapYear bool)

Arguments

Name

Type

Description

year

uint256

isWeekDay

function isWeekDay(uint256 timestamp) internal pure
returns(weekDay bool)

Arguments

Name

Type

Description

timestamp

uint256

isWeekEnd

function isWeekEnd(uint256 timestamp) internal pure
returns(weekEnd bool)

Arguments

Name

Type

Description

timestamp

uint256

getDaysInMonth

function getDaysInMonth(uint256 timestamp) internal pure
returns(daysInMonth uint256)

Arguments

Name

Type

Description

timestamp

uint256

_getDaysInMonth

function _getDaysInMonth(uint256 year, uint256 month) internal pure
returns(daysInMonth uint256)

Arguments

Name

Type

Description

year

uint256

month

uint256

getDayOfWeek

function getDayOfWeek(uint256 timestamp) internal pure
returns(dayOfWeek uint256)

Arguments

Name

Type

Description

timestamp

uint256

getYear

function getYear(uint256 timestamp) internal pure
returns(year uint256)

Arguments

Name

Type

Description

timestamp

uint256

getMonth

function getMonth(uint256 timestamp) internal pure
returns(month uint256)

Arguments

Name

Type

Description

timestamp

uint256

getDay

function getDay(uint256 timestamp) internal pure
returns(day uint256)

Arguments

Name

Type

Description

timestamp

uint256

getHour

function getHour(uint256 timestamp) internal pure
returns(hour uint256)

Arguments

Name

Type

Description

timestamp

uint256

getMinute

function getMinute(uint256 timestamp) internal pure
returns(minute uint256)

Arguments

Name

Type

Description

timestamp

uint256

getSecond

function getSecond(uint256 timestamp) internal pure
returns(second uint256)

Arguments

Name

Type

Description

timestamp

uint256

addYears

function addYears(uint256 timestamp, uint256 _years) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_years

uint256

addMonths

function addMonths(uint256 timestamp, uint256 _months) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_months

uint256

addDays

function addDays(uint256 timestamp, uint256 _days) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_days

uint256

addHours

function addHours(uint256 timestamp, uint256 _hours) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_hours

uint256

addMinutes

function addMinutes(uint256 timestamp, uint256 _minutes) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_minutes

uint256

addSeconds

function addSeconds(uint256 timestamp, uint256 _seconds) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_seconds

uint256

subYears

function subYears(uint256 timestamp, uint256 _years) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_years

uint256

subMonths

function subMonths(uint256 timestamp, uint256 _months) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_months

uint256

subDays

function subDays(uint256 timestamp, uint256 _days) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_days

uint256

subHours

function subHours(uint256 timestamp, uint256 _hours) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_hours

uint256

subMinutes

function subMinutes(uint256 timestamp, uint256 _minutes) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_minutes

uint256

subSeconds

function subSeconds(uint256 timestamp, uint256 _seconds) internal pure
returns(newTimestamp uint256)

Arguments

Name

Type

Description

timestamp

uint256

_seconds

uint256

diffYears

function diffYears(uint256 fromTimestamp, uint256 toTimestamp) internal pure
returns(_years uint256)

Arguments

Name

Type

Description

fromTimestamp

uint256

toTimestamp

uint256

diffMonths

function diffMonths(uint256 fromTimestamp, uint256 toTimestamp) internal pure
returns(_months uint256)

Arguments

Name

Type

Description

fromTimestamp

uint256

toTimestamp

uint256

diffDays

function diffDays(uint256 fromTimestamp, uint256 toTimestamp) internal pure
returns(_days uint256)

Arguments

Name

Type

Description

fromTimestamp

uint256

toTimestamp

uint256

diffHours

function diffHours(uint256 fromTimestamp, uint256 toTimestamp) internal pure
returns(_hours uint256)

Arguments

Name

Type

Description

fromTimestamp

uint256

toTimestamp

uint256

diffMinutes

function diffMinutes(uint256 fromTimestamp, uint256 toTimestamp) internal pure
returns(_minutes uint256)

Arguments

Name

Type

Description

fromTimestamp

uint256

toTimestamp

uint256

diffSeconds

function diffSeconds(uint256 fromTimestamp, uint256 toTimestamp) internal pure
returns(_seconds uint256)

Arguments

Name

Type

Description

fromTimestamp

uint256

toTimestamp

uint256