When I went to bed. How long does it take for the food to turn into fat?

Already has happened. Fat is in the diet and your digestion only converts it into a form that can be absorbed by the intestines. It takes about 2 hours for the fat to get from the stomach into the intestine and then it can be absorbed and burned if needed or stored as fat deposits.