Skip to content

Conversion operations between Unix timestamp and human readable time.

License

Notifications You must be signed in to change notification settings

guvenemirhan/unix-timestamp-sol

Repository files navigation

Unix-timestamp-sol

DateOperations

This library performs conversion operations between Unix timestamp and human readable time.

Date

struct Date {
  uint8 day;
  uint8 month;
  uint16 year;
  uint8 hour;
  uint8 minute;
  uint8 second;
  int8 gmt;
}

InvalidGmtValue

error InvalidGmtValue(int256 value, string dateType)

InvalidDateValue

error InvalidDateValue(uint256 value, string dateType)

paramsCheck

modifier paramsCheck(struct DateOperations.Date date)

It checks whether the parameters exceed the specified limits or not.

toTimestamp

function toTimestamp(struct DateOperations.Date date) internal pure returns (uint256 unixTimestamp)

It converts the given date parameter to a Unix timestamp value.

Parameters

Name Type Description
date struct DateOperations.Date The date that will be converted to a Unix timestamp value.

Return Values

Name Type Description
unixTimestamp uint256 The unix timestamp value of the given date.

toDate

function toDate(uint256 unixTimestamp) internal pure returns (struct DateOperations.Date dates)

About

Conversion operations between Unix timestamp and human readable time.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published