I have a strange business requirement to output dates as 01:00 through 24:00, instead of the usual 00:00 through 23:00. It is really a crazy requirement, but unfortunately I don’t think I can avoid it.
This will be a configuration option in our software, so I’ll still need to support the normal 00-23 as well, so I’m hoping I can do this somehow with format strings. But I’m also considering using a regex to post-process the result string if that makes it easier.
Thanks!
This sounds like a good candidate for a wrapper class which is used to format the DateTime according to business rules:
Alternatively, and perhaps even more correctly, you can create a type which represents the business’s idea of a DateTime. In object-oriented design, this replacement of primitive types with custom types happens frequently, since the domain to be modeled has special restrictions just like this one that you describe.