Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key

Get block by date

GEThttps://deep-index.moralis.io/api/v2.2/dateToBlock

Find the closest block to a specific date on a blockchain.

QUERY PARAMS
chainstring
The chain to query
datestring
Unix date in milliseconds or a datestring (format in seconds or datestring accepted by momentjs)
Responses
200Returns the block number and corresponding date and timestamp
400Bad Request
404Not Found
429Too Many Requests
500Internal Server Error
API KEY
curl --request GET \
--url 'https://deep-index.moralis.io/api/v2.2/dateToBlock?chain=eth&date=2025-09-01T00%3A00%3A00Z' \
--header 'accept: application/json' \
--header 'X-API-Key: YOUR_API_KEY'
Response Example
{
"date": "2020-01-01T00:00:00+00:00",
"block": 9193266,
"timestamp": 1577836811,
"block_timestamp": "2019-12-31T23:59:45.000Z",
"hash": "0x9b559aef7ea858608c2e554246fe4a24287e7aeeb976848df2b9a2531f4b9171",
"parent_hash": "0x011d1fc45839de975cc55d758943f9f1d204f80a90eb631f3bf064b80d53e045"
}