Help for owners
The times on my orders and reports are wrong by several hours
Short answer
Times go wrong when the server, the database, the application and the browser each use a different time zone, or when a value was stored without one. Do not edit old records by hand. Find which layer disagrees first, because changing the server clock can shift every new time at once.
Does this sound like your situation?
- An order placed at noon shows as 7 am, or the next day.
- My daily report cuts off at the wrong hour, so late orders land on the wrong day.
- Booking slots appear at different times for me and for my customer.
- Times were right until the servers or hosting were moved.
- Emails or invoices show a different time than the dashboard.
Why does this happen?
The database shows times in the connection's time zone
In PostgreSQL, a timestamp with time zone is stored internally in UTC and always shown converted to the current session TimeZone setting. If the application, the database session and the host are set differently, the same moment is shown differently.
Confirmed by postgresql.org
Some times are stored with a zone and some without
PostgreSQL states that a timestamp without time zone is stored as written, with no UTC conversion, and that a zone in the input is silently ignored. A system that mixes the two types can show times that move when a setting changes.
Confirmed by postgresql.org
A move to a new server changed the default
A new host often starts in UTC or in the data centre's region. Old records were saved in one zone and new ones in another, so the history has a hidden step in it.
Technical detail: Connector/J cannot work out the MySQL server time zone
Daylight saving time
Clocks that move twice a year create a duplicated hour and a missing hour. Reports and bookings that count in local hours go wrong around these dates.
The screen converts but the record does not
A browser or app may convert a stored time to the viewer's zone, while an email or invoice prints the raw stored value.
What can I do about it today?
- Take one example orderWrite down the real time you placed it, the time in the dashboard, the time in the confirmation email and the time on the invoice. The pattern of differences points to the cause.
- Do not change records by handAdding or subtracting hours in the data can double-correct once the real cause is fixed. Leave existing orders as they are.
- Do not ask the host to change the server clockChanging the server's time zone shifts every new timestamp at once and can break scheduled jobs and reports.
- Say which numbers matter to youTell your developer which reports, cut-off times and invoices you rely on, and in which time zone your business works.
- Keep screenshotsDated screenshots of wrong times help separate old records from new ones.
When should I bring someone in?
- Invoices or tax-relevant documents carry the wrong time.
- Customers in several countries book or order and see different times.
- The problem started after a server or hosting move.
How do I handle it?
- Trace one record through every layerFrom the browser to the application, the database and the server clock, I find the layer where the time changes.
- Choose one rule for storing timeA single agreed way, usually storing in UTC and converting only for display, written down so the whole team follows it.
- Fix new data first, then plan old dataExisting records are corrected only when the rule is clear, on a copy first, with a backup before any change to production.
- Check the edge casesMidnight cut-offs, daylight saving dates and customers in another zone are tested before I call it done.
The price depends on what I find, so I quote in writing after a short discovery call. Tell me what is happening and I reply within 24 hours.
What do owners ask about this?
Is it safe to change the time zone on my server?
Not without a plan. It changes how new timestamps are produced and can affect scheduled tasks. Check which layer is wrong first.
Why are only some orders wrong?
Usually because the setting changed at a certain date, for example after a move, so only records from one side of that date are affected.
Which time zone should a business store?
That is a design decision for your system. PostgreSQL's documentation says its zone-aware type is stored internally as UTC and converted for display; your developer should agree one rule and apply it everywhere.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Found a mistake? Tell me.