Skip to content

API ReferenceAdvanced utilities and typesFunction

dateToEthereumTimestamp()

function dateToEthereumTimestamp(d): bigint;

Converts a JavaScript Date to the Unix-seconds bigint the protocol uses for every on-chain timestamp (expirationTimestampSeconds, createdTimestampSeconds). Truncates sub-second precision toward zero. Inverse of ethereumTimestampToDate.

Parameters

ParameterTypeDescription
dDateThe date to convert.

Returns

bigint

Whole Unix seconds since the epoch.