there is a function in many ico contracts that allow people to adjust their allow purchase and disable purchase functions according to the current block height, basically a function that opens an ICO and closes it due to block height, but how do the contract deployers know how many blocks are mined everyday? Doesn't this change every week? How do they know to the exact minute when their ICO will end and when it will start?
These developers don't know the exact minute their ICO would begin and end, however, they can approximate it relatively closely over short intervals by looking at the current average block time. Over longer intervals, the speed per mined block is going to increase (Ice Age) and then drastically decrease (Casper), so I would recommend looking at block.timestamp instead for a better gauge.