Dates & Time Zones
Verified against source (9)
Extensions/StringExtensions.csapplication/AbstractObject.csapplication/Functions.csUtilities/XsltFormatting.csProperties/Settings.settingsConfiguration/SqlPattern.csdecision/ImportForm.csTables/ImportForm.sqlFunctions/TimeDimensionInterval.sql
Every date in QBO is a moment in time with a time zone offset: a completion date, a due date, the time a record was created. When you send a date with no time and no offset, such as 10/11/2020, QBO has to decide which midnight you meant. It uses the time zone of the QBO server, and that choice is the reason a date can look a day off later.
By default, most QBO servers run on GMT (UTC, offset +00:00), not in your local time zone. Unless Quandis has told you otherwise, assume a date you send without an offset is read as a GMT date and time.
This page explains how QBO stores, reads, and displays dates, and how to send dates so they mean what you intend.
How QBO stores dates
Section titled “How QBO stores dates”QBO keeps dates with their offset from UTC. A form completed at midnight on October 11, 2020, on a server running US Eastern time is stored as:
2020-10-11 00:00:00 -04:00The offset (-04:00) is part of the value. It records the moment exactly: four hours after midnight UTC. The same moment can be written as 2020-10-11 04:00:00 +00:00 or 2020-10-10 21:00:00 -07:00. All three are equal, but each reads as a different calendar day or time depending on the zone you view it in.
That is the whole story behind most date surprises: the moment is stored correctly, and the calendar day you see depends on the time zone used to show it.
How QBO reads the dates you send
Section titled “How QBO reads the dates you send”When you save a record through the API, an import, or a form, QBO reads each date value like this:
| What you send | What QBO stores |
|---|---|
A date and time with an offset, e.g. 2020-10-11T00:00:00-05:00 |
Exactly that moment and offset. |
A date and time ending in Z, e.g. 2020-10-11T00:00:00Z |
That moment in UTC (+00:00). |
A date or date and time without an offset, e.g. 10/11/2020 or 2020-10-11 14:30 |
That clock time in the QBO server’s time zone, with the server’s offset for that date (daylight saving time included). |
A keyword such as {today} or {now} |
The server’s current date or time, with the server’s offset. |
Dates without an offset are read in the server’s regional format, so 10/11/2020 means October 11 on a server set to US English. ISO 8601 (2020-10-11) avoids that ambiguity.
Example: completing a form with a date only
Section titled “Example: completing a form with a date only”A common integration call completes a form by setting its completion date:
POST /api/importform/save?ID=1234&ActualCompletion=10/11/202010/11/2020 has no time and no offset, so QBO reads it as midnight on October 11 in the server’s time zone:
| QBO server time zone | Value stored |
|---|---|
| GMT (the default for most QBO servers) | 2020-10-11 00:00:00 +00:00 |
| US Eastern | 2020-10-11 00:00:00 -04:00 |
| US Pacific | 2020-10-11 00:00:00 -07:00 |
On a GMT server, that value is 8:00 PM on October 10 in US Eastern time and 5:00 PM on October 10 in US Pacific time.
Two more rules apply when saving a form:
- If you send today’s date with no time when updating a form, QBO records the current time instead of midnight.
- If you save a form without a completion date, QBO completes it now by default (see Forms).
Where the display time zone applies
Section titled “Where the display time zone applies”QBO has one application-wide display time zone setting (DisplayTimeZone), chosen from a list of time zones in the application settings. It is empty by default, which means “show dates in the server’s time zone”.
When it’s set, screens and generated documents that format dates convert each date to that zone before showing it. It does not change what’s stored, how incoming dates are read, or how searches and reports filter. QBO has no per-user time zone: everyone sees the same zone.
Because a date-only value is stored as midnight, converting it to a zone west of the server’s zone moves it to the evening before:
| Stored | Display time zone | Shown as |
|---|---|---|
2020-10-11 00:00:00 -04:00 |
(empty, server is US Eastern) | 10/11/2020 |
2020-10-11 00:00:00 -04:00 |
Pacific Standard Time | 10/10/2020 (9:00 PM) |
2020-10-11 00:00:00 +00:00 |
(empty, server is GMT) | 10/11/2020 |
2020-10-11 00:00:00 +00:00 |
Eastern Standard Time | 10/10/2020 (8:00 PM) |
The last row is the most common surprise: on a GMT server, setting the display time zone to a US zone shows every date-only value as the day before.
A separate setting can tell date formatting to ignore the time and offset of a value. It removes the time before formatting, but the date is still converted to the display time zone if one is set, so it doesn’t prevent the shift above.
How dates behave in searches and reports
Section titled “How dates behave in searches and reports”Filtering by a date. A search such as ActualCompletion=>10/11/2020 or a range ActualCompletion=-10/11/2020,10/12/2020 reads those dates the same way a save does: midnight in the server’s time zone. A date-only value saved through the same server falls on the day you expect. A value with a time is compared as a moment, so the day boundaries are the server’s midnights: on a GMT server, a form completed at 8:30 PM US Eastern on October 11 is 12:30 AM GMT on October 12, and lands in the next day’s range.
Grouping by day. Dashboards that group a date by day, week, or month build their buckets from the server’s calendar days but compare them as UTC. On a GMT server, the default, buckets and filters agree: both use GMT days. On a server in another zone, a value late in the evening can fall into the next day’s bucket, even though a filter for that day would include it.
Custom SQL reports. In SQL, the stored offset is kept. Converting a value to a date (CAST(ActualCompletion AS date)) gives the calendar day as it was recorded, in the zone of whoever recorded it. To report every record in one business time zone, convert first: CAST(ActualCompletion AT TIME ZONE 'Eastern Standard Time' AS date).
Users and systems in different zones. Two systems that send 10/11/2020 to the same server get the same value. Two systems that send their own local midnight with offsets get different moments, which is correct, but they can then show on different days in a single display zone. Decide which zone defines a business day for your process and send dates in that zone.
Recommendations
Section titled “Recommendations”- Send ISO 8601 with an offset for every date with a meaningful time:
2020-10-11T14:30:00-04:00. QBO stores exactly what you send, whatever the server’s zone. - For a business date with no time (a completion date, a sale date), send midnight in the time zone that defines the business day, with its offset:
2020-10-11T00:00:00-04:00. Don’t send2020-10-11T00:00:00Zunless the business day really is a UTC day: in a US zone it displays as the evening before. - Avoid regional formats like
10/11/2020in integrations. They depend on the server’s language and time zone. - Know your server’s time zone before setting a display time zone. Most QBO servers run on GMT by default; ask Quandis to confirm yours. If the display zone is west of the server’s zone (any US zone, on a GMT server), midnight values display as the previous evening.
- In reports, decide on one business time zone and convert to it before grouping or filtering by day.
Choose Developer for the code paths behind each rule, the settings involved, and how search filters are built.