Terraform does not directly address the use-case you shared here, of automatically starting and stopping EC2 instances. However, you could potentially use Terraform as a part of a solution to meet that requirement.
In a purely manual mode of working, you could write a Terraform configuration to describe the EC2 instance and any other related infrastructure and then use terraform apply when you need it and then terraform destroy later when you no longer need it. Because you described the configuration of the infrastructure as code, you can recreate equivalent infrastructure with a single command.
Some teams use an approach like what I described above but use some other automation solution to run those steps automatically at particular times of day, for example so that the infrastructure is available during your company’s normal business hours but not available outside of those hours. Setting that up will require some other software outside of Terraform’s scope, but it only needs to be something that is capable of running commands in a particular system context (such as a Docker container image, or similar) on a predefined schedule.
In the AWS domain I’ve heard of folks doing this with AWS Lambda functions configured to run on a schedule, presumably with the appropriate terraform executable included in the function’s source code package so that the lambda function can execute it. However, I don’t have any direct experience with that and so I can’t show a full example.