I think that you're connected to your router, but only to the Local area network (so no outside, or internet as you call it, connection) because, even with a weak security router, you should have access to the internet, as I had on my holiday a few weeks back
First try and restart your Mac and see if the date and time are correct
If this is not working, you can try and run wifi diagnostic
Wi-Fi Recommendations. Click Wi-Fi in Control Center or the menu bar and check for a menu item named Wi-Fi Recommendations. If you see it, your Mac has detected an issue and has recommendations. Choose Wi-Fi Recommendations to learn more.*
Wireless Diagnostics. Press and hold the Option key on your keyboard while clicking Wi-Fi in Control Center or the menu bar, then choose Open Wireless Diagnostics from the menu. Learn more about using Wireless Diagnostics to analyze your wireless environment.
If you're the manager of your router, you can try and see if your router needs a software update, and try and restart the router.
Also make sure to see this link and follow the instructions provided to set your security settings correct on your router
Recommended settings for Wi-Fi routers and access points – Apple Support (UK)