Handling dates and times... should be simple right?

Save
    Written by HarmonyPSA on 2018-06-06 Last updated 2018-06-06 - 2 minute read

Handling date and time is a perennial software problem; exacerbated by the fact that most programming languages do not differentiate between a date and a datetime.

In order to deal with this, we explicitly recognise and code for the fact that there are typically three different things being talked about when discussing time:

[1]  Time zone aware datetime

These are a point in time (usually stored as UTC) which, when presented to the user, will show the equivalent datetime in their time zone. The programmer also has to account for the fact that datetimes entered will come in from the perspective of that user so need to be converted back to UTC for storage.

These throw up an interesting issue for reporting. If you run reports out of a system and two people run the same report in two different time zones, they will be looking at different data. Worse, if an external reporting system is looking directly at the database and the times are stored as UTC, then reports will not make sense to anyone.

Harmony solves the above issues by:

  • Having a specific internal type of object for time zone aware datetimes
  • These are stored as two values; one using a global reporting time zone, and one as UTC for use in the user interface
  • Datetime calculations can still be done against these within the application, in user report filtering and in the configurable rules engine

The benefit of this approach is that when a ticket is passed to another timezone for work, this does not impact the SLA as the ticket’s SLA is in the timezone it was created in.

[2]  Non time zone aware dates

Dates are another interesting issue. When someone in Georgia asks someone 1 hour time zone across, say in Alabama, ‘Are we doing that work on Thursday?’ you can safely assume they are talking about the same day.

Due to the fact that most programming languages only have a datetime data type, this would normally be stored as midnight on that day, or in other words ‘1 Jan 2000 00:00:00’. The issue is that this is stored as a time in time and space but is actually not. If that stored datetime was to be shifted with timezone, then the person in Alabama would actually see ‘31 Dec 1999 23:00’, which when rendered as just a date in the system looks like the day earlier and confusion ensues…

Harmony solves this issue by:

  • Having a specific type of object for non-timezone aware dates, such as those used for project planning
  • When entered by the user these are not converted back to UTC but are just stored as given
  • Datetime calculations can still be done against these within the application, in user report filtering and in the configurable rules engine

[3]  Times which are not a specific instant

This is another interesting issue. Sometimes you want to store the concept of a time, ie 09:30. This is not a specific time, either time zone aware or not, but rather just defining a time; “When do you usually do that?”, “oh around 9:30”…

In Harmony we have a specific time object which is not timezone aware that can be defined in the user interface and time-related calculations can be done within Harmony against it.

Sounds complicated. Why does it matter?

As more and more MSPs are using offshore out-of-hours ticket handling, timezone-aware systems become necessary to ensure reporting is not compromised. Harmony handles this problem correctly and seamlessly from a user perspective, in a way which provides great multi timezone functionality, without any of the downsides.

Just one small example of the care we take in our multi-build framework to deliver clarity to the user.

Book a Demo

 

About the Author: Harmony Business Systems Ltd (HBS) is the company behind HarmonyPSA, the most complete cloud PSA software on the market. Developed with functionality to cater for even the most complex needs of MSPs, VARs, ISVs and Professional Services organisations, HarmonyPSA truly is the next generation of PSA systems. HBS is an independent company based in the UK. Follow HarmonyPSA on


Tags: global business, multi-time zone

Categories

Recent posts

Subscribe to our blog