Is there a way to prevent my use of my Mac during certain hours? For instance by not being able to login between 7pm and 7am.

That is for myself, for my own user account on my Mac.

I'd like to make sure I can't use my Mac during night time.

I'm using macOS 10.14.6.
I'm not sure what you're doing on your Mac that you wouldn't want to be doing, but as far as I know there's no way to restrict login entirely.

You could, however, make it impossible to use the Internet on your Mac, which (at least for me) would dramatically reduce the likelihood that I was going to try to use it.

One such app for this is called (rather ironically) Self Control.

The only downside is that I believe you would have to set it every day. Maybe someone else will have a better idea.