Depends on your architecture, specifically your application domain: Lets say that the reason you can receive hours as a parameter, is because there is a specific hardware that only tracks hours spent on something, and this hardware is used to provide this parameter, then it would make sense to store the data that is specific for that hardware in it's own table. And, lets propose a punch clock tracks logins and logouts, for duration calculation, then store those timestamps in a different table would make sense. However, if the domain, is ONLY to aggregate over hours, then a single
table is fine, and you can simply store (to-from).hours, together with "hours" domain model as one DB model The trick is to understand how and why something will be used, so you can model your code to appear as close to reality as possible, and by "reality" I mean, as close to how the code will accomplish something for the real world, not by actual reality.
But if you have to store Datetime from, DateTime to, as null, when only hours is provided, consider your model carefully, aren't you trying to solve two responsibilities at the same time, if you can disregard half the properties in your class? If they are optional, doesn't that mean that you are technically doing two things in one class? That is usually not desirable
As a general rule of thumb, you want one reason to change your code. If the hardware of your hours device changes, should I need to review and retest the code of the punchclock? Why? That would be annoying. Segregate responsibility as a rule, unless you see the actual usage, "hide" the differences from both the system and the user. In my own personal opinion, I would happily segregate too many responsibilities, rather than too few. Fixing a high coupling low cohesion code base is always worse than the opposing scenario.
Last comment, make sure your clean code rules are also maintained, if you segregate code a lot, but don't use proper clean code techniques, you can end up making your code more confusing. The number 1 metric of good code, is: "Can other people easily understand my code". If the answer is yes, then this code is good, even with the WORST performance since 1945. Because, someone can understand what the code is meant to do, and help you fix your under performing code. If they cannot understand your code, they can't help you.