An image forming apparatus capable of switching a state of the image forming apparatus between a first power state and a second power state in which less power is consumed than in the first power state, the image forming apparatus comprising:
- a detection device that detects a detection target;
- a reception device that receives an operation from the detection target and generates operation information indicating an operation content of the detection target;
- and
- a control device that includes a processor and functions as a determination device and a changing device by the processor executing a control program, the determination device determining whether use of the image forming apparatus has ended, and the changing device changing a first period of time, which is required to transition from the first power state to the second power state, to a second period of time that is shorter than the first period of time, wherein
- the operation information includes end information regarding end of the operation,
- the determination device determines whether the use of the image forming apparatus has ended based on the end information and a detection result of the detection device, and
- when the determination device determines that the use of the image forming apparatus has ended, the changing device changes the first period of time to the second power state, to the second period of time.