For time zones in business software, store timestamps in UTC, keep each user's time zone as a separate setting, and convert to local time only when showing a value. Store calendar dates without a time, such as invoice due dates, as plain dates. Test the days when daylight saving changes, because that is where many errors appear.
Key takeaways
- Store every event timestamp in UTC, and keep the original zone where a business rule depends on local time.
- Store a user's time zone as a named identifier such as Europe/Brussels, not as a fixed offset such as +01:00.
- Store calendar dates without a time component when the value means a day rather than a moment.
- Test the hours around each daylight saving change, because skipped and repeated hours expose most of the faults.
Why do time zone bugs appear in business software?
They appear because a clock reading on its own does not identify a moment. The same text such as 09:00 on 14 May can mean different instants depending on where the value was recorded, which zone the server uses, and whether the clock was adjusted for summer time.
Problems usually start at a boundary. A dispatcher in Antwerp enters a delivery window, a warehouse server in another time zone reads it, and a supplier in the Netherlands receives a confirmation. Each system may be internally consistent, yet the three of them disagree about when the delivery happens.
Reports are a common symptom. A daily sales total built from timestamps stored in local time can place an order placed late in the evening into the wrong day, so a finance figure changes depending on which server ran the query.
Should you store local time or UTC?
Store points in time in UTC and convert them for display. A point in time, such as the moment a payment was received, has one correct value regardless of who reads it, and UTC gives every system the same reference. The timestamp format should also carry its offset, as described in RFC 3339, which defines date and time timestamps for internet protocols.
Local time is the right choice only where the meaning follows the local clock. A recurring shift that starts at 09:00 in Brussels is one example: the business rule is about the local hour, not a fixed instant. For such cases, store the local time together with a named zone identifier, so the system can calculate the correct UTC instant for each occurrence.
Why a fixed offset is not enough
A fixed offset such as +01:00 describes the difference from UTC at one moment only. Many zones change their offset during the year, so a record that stores only the offset will be wrong for part of the year, and it cannot be corrected later because the zone name was lost.
Date-only values
An invoice due date or a public holiday is a calendar day, not an instant. Storing it as midnight UTC shifts it to the previous day for users west of Greenwich. Plain date fields avoid this problem entirely.
How does daylight saving change the calculation?
Daylight saving makes some local times occur twice and others not at all on the days when the clocks change. Any calculation that assumes every day has twenty-four hours, or that every local time maps to exactly one instant, can produce wrong results on those days.
The EU directive on summer-time arrangements sets the common schedule for member states. As its text states, summer time begins on the last Sunday in March and ends on the last Sunday in October, with the change made at 01:00 UTC; see Directive 2000/84/EC on summer-time arrangements on EUR-Lex. This article is general information and not legal or tax advice.
The IANA time zone database records the historical and future rules that software uses to make these conversions, and it is updated when governments change their rules. Relying on a current database rather than hard-coded offsets is one of the most practical safeguards; the IANA Time Zone Database is the reference many platforms build on.
The skipped hour
When clocks move forward, a local time such as 02:30 does not exist. A job scheduled for that moment may never run, or a system may silently store a time that does not correspond to any instant.
The repeated hour
When clocks move back, an hour repeats. A value such as 02:30 can refer to two different instants, so a system that records only the local time cannot tell which occurrence was meant.
Hypothetical examples of time errors
Here are two hypothetical scenarios:
In the first, a field service tool stores appointment slots as local times without a zone identifier. An appointment booked for a slot in the skipped hour is never shown on the technician's schedule, because the calendar view cannot render a time that does not exist on that morning.
In the second, a nightly export job runs at a fixed UTC hour and stamps each file with the date of the run. Customers in a zone ahead of UTC receive files dated the following day, and their accounting import rejects entries that appear to fall outside the period being closed.
Neither scenario describes a real organisation. Both are useful because they show that the fault sits in the storage decision, not in the display code, so testing the display alone will not reveal it.
What should a time handling checklist include?
A short checklist makes the design choices explicit before a feature ships. It should cover storage, display, scheduling and integration.
- Each event timestamp is stored in UTC with its offset or as an unambiguous instant.
- Each user or location has a named time zone identifier, not a fixed offset.
- Calendar dates that mean a day are stored as plain dates without a time.
- Recurring schedules store the local time and zone, and the next occurrence is computed at run time.
- Scheduled jobs are tested at the skipped and repeated hours on each transition day.
- Exports and integrations state the zone or use UTC explicitly.
- Reports group by a documented time zone, so totals do not change with the server location.
Where do these approaches fail?
Each approach fails when the data it depends on is incomplete or wrong. UTC storage is only as good as the conversion at the point of entry, so a form that accepts a local time without knowing the user's zone will still store the wrong instant.
Integrations are a frequent weak point. A partner system may send naive timestamps without an offset, and the receiving system must either reject them or assume a zone. Both choices should be written down in the interface contract, and the assumption should be tested against real transition dates. Teams working on system integration for connected data flows usually find that this contract is the cheapest place to prevent errors.
Connected business systems add a second layer. When an order moves from a web shop into an ERP and then into a CRM, each step may store time differently. Aligning those rules is part of ERP and CRM integration work, and it is easier to design in from the start than to repair across three databases later.
Finally, custom logic can hide the problem. A scheduling rule written as a fixed number of hours will drift on transition days. Replacing it with calendar-aware functions is a small change, but it needs to be part of a wider review of integration and API engineering practice so that every service follows the same rules.
Conclusion
Reliable time handling in business software comes down to a few deliberate decisions: store instants in UTC, store zones as named identifiers, store days as days, and test the transition hours. These choices are inexpensive when made at design time and costly to unpick once records and reports depend on them. If you are planning a new system or reviewing an existing one, you can request a project consultation at https://ruicodex.com/Contact, or email info@ruicodex.com to discuss the time handling in your project. Rui Codex can also review how custom software for Belgian businesses manages these rules, through its custom software development service.
Frequently Asked Questions
Should I store dates in UTC or local time?
Store point-in-time events in UTC and calendar dates without a time. A payment timestamp belongs in UTC, while an invoice due date should be a plain date, because converting a day through UTC can move it to the wrong calendar day for some users.
What is the difference between a time zone and a UTC offset?
A time zone is a named set of rules, such as Europe/Brussels, that defines offsets over the whole year. A UTC offset is only the difference from UTC at one particular moment, so storing an offset alone loses the rule needed for future and past dates.
Why do scheduled jobs run twice or not at all during daylight saving changes?
They do so when the schedule is defined in local time and the local clock either skips an hour or repeats one. Scheduling in UTC or computing the next run from a named zone removes the ambiguity, and testing the transition hours confirms the behaviour before release.
Do I need to store the time zone for every record?
No, only where a business rule depends on local time, such as recurring opening hours or shifts. Records that describe a single moment need only the UTC instant, which already identifies one point in time for every reader.
Sources
- Directive 2000/84/EC on summer-time arrangements - EUR-Lex, Publications Office of the European Union
- RFC 3339: Date and Time on the Internet: Timestamps - RFC Editor
- IANA Time Zone Database - Internet Assigned Numbers Authority