calculate row and column based on time