How to create block height to UNIX time converter? I want to create a converter that can be given a block height, human readable time, or UNIX time and then provide the correlated information for it. For example, if given a block height, the converter will give you an estimated time (UNIX and converted to human readable format). And the same if given a UNIX time, it'll provide block height and human readable time associated with that block. And so forth if given a human readable string (stretch goal). 

However, looking at the information online it seems pretty lack luster and also very approximate, using formulas, etc. See links here of similar questions: 

https://ethereum.stackexchange.com/questions/10576/calculate-approximative-block-height-at-a-certain-time

https://www.reddit.com/r/BitcoinBeginners/comments/87lr89/is_there_any_block_height_to_datetime_converter

Are there any methods that could be achieved to create a deterministic result?

One method, I am considering is to iterate through the blockchain and generate a database that stores the block height and the UNIX timestamp associated in the block header of the block. Would this be a proper solution to the problem?
In theory there is one block per 10 minutes. That means you should be able to approximate the time of a block n as FIRST_BLOCK_TIME + n*600, where FIRST_BLOCK_TIME is the time of the genesis block, 1231006505.

Of course, that's very approximate, as the average time per block has been consistently less than ten minutes due to increasing block difficulty. In fact, as of writing (block 622719 with timestamp 1585016395), is 19621510 seconds earlier (over 7 months) than what would be predicted by that formula.


  One method, I am considering is to iterate through the blockchain and generate a database that stores the block height and the UNIX timestamp associated in the block header of the block. Would this be a proper solution to the problem?


Using the real data is obviously going to be better than any approximating formula. Note that the timestamp of blocks are not necessary the actual time they are mined (in normal circumstances they can be up to 2 hours in the future, and up to approximately 1 hour in the past).