Time
POSIX Time
Unix timestamp handling for Cardano transactions
POSIX Time
Evolution SDK uses Unix timestamps in milliseconds (bigint) for all time-related operations. The UnixTime type represents milliseconds since the Unix epoch (January 1, 1970).
Getting Current Time
// Current time as bigint milliseconds
const = (.())
// From a specific date
const = (new ("2025-12-31T23:59:59Z").())Common Conversions
// ADA amounts in time
const = 5n * 60n * 1000n // 300,000ms
const = 60n * 60n * 1000n // 3,600,000ms
const = 24n * 60n * 60n * 1000n // 86,400,000ms
// Future deadline
const = (.())
const = +
const = + Usage in Transactions
Time values are passed to .setValidity() as Unix milliseconds. The builder converts them to slots automatically:
import { } from "@evolution-sdk/evolution"
const = ({
: "preprod",
: { : "blockfrost", : "https://cardano-preprod.blockfrost.io/api/v0", : ..! },
: { : "seed", : ..!, : 0 }
})
const = (.())
// Transaction valid for the next 10 minutes
// const tx = await client.newTx()
// .setValidity({ from: now, to: now + 600_000n })
// ...Next Steps
- Slots — How Unix time maps to slots
- Validity Ranges — Setting time constraints on transactions