Don't tie up an expensive camera or use a cheap one not designed for this purpose (many photos/videos over a long period of time). Either get a "Timelapse Camera" or a "Trail Camera".
Example video from a Timelapse Camera: Brinno TLC120
List of Trail Cameras: https://www.bhphotovideo.com/c/buy/Trail-Wildlife-Digital-Cameras-Accessories/ci/13927/N/3808211484
Example video of results from and feature set of a typical Trail Camera: Moultrie M-1100i Mini Game Camera
Depending upon the purported quality and features a "Timelapse Camera" will be a cheaper, less durable, featureless, one trick pony.
As you can see from the video demonstrating a "Trail Camera" it has an enormous list of features (easy to add in software) that are lacking from a tiny/cheap "Timelapse Camera".
The trail cam shoots (depending upon the model and cost) 20K+ 20MP photos / 4K video for a year on a battery pack. They are designed to run 24/7 winter/summer outdoors anywhere. They do timelapse, motion detection, or combo of those two, have invisible IR and 'white flash' and are camouflaged/small animal-proof and people proof (physically lockable and encrypted so if it's stolen it's useless) - which features depends upon the price and manufacturer.
Read recent reviews and do a lot of research before deciding upon a specific manufacturer and model. It's an investment that will last many years for ~ 2 - 5 hundred dollars. Plan to get use out of it after your 'out the window' photo series (like capturing wildlife in the backyard or catching who's stealing packages/newspapers).
If you'd rather use a 'good camera' you'll want an Intervalometer / external timelapse remote control as discussed in this "Learning Timelapse" article - I advise against wearing out a decent camera, cooking it in the Sun on an external power supply.