Local Time to UTC Shift Start Times across timezones

I’m working on a system in Ignition that pulls order confirmations from an API. The API stores all confirmations in UTC, which is ideal.

The challenge I’m facing is that these confirmations originate from multiple plants, each in different time zones and operating on different shifts. The shift start and end times are defined in each plant’s local time. Because of this, when daylight saving time occurs, the corresponding UTC start and end times shift as well.

My goal is to create a UDT for each plant that can handle these time zone and daylight saving adjustments. While I know I can manage time zone conversions within each Perspective client, I would prefer to handle shift time logic at the tag level. This would allow me to automatically calculate and maintain accurate UTC start and end times while keeping each plant’s configuration aligned with its local time zone.

If I rely solely on client-side logic, there’s a risk that a user opening a session from a different time zone could retrieve data that is offset (for example, by an hour), leading to inconsistencies. By centralizing this logic in tags, I can ensure consistency regardless of where the client session is launched.

Looking for any thoughts on handling this?

I would store just the relevant ZoneId in the tag, and do everything else in the UI. See these topics for references to using java's more capable date/time classes:

So for the shift start and end time if I store that data in a tag as a string the client can make it's own determination on what the UTC value of that is when it evaluates that?

So for example i have 2 tags
StartTime 8:00am
EndTime 4:30pm

Because my client is timezone aware and my start and end time are strings the client should resolve those to the correct time in UTC as long as I am doing the scripting on the UI NOT in the tags? I can do something like a system.date.setTime. It gets more complex passing midnight, but I can handle that in a script as well.

Under no circumstances are you to use the built-in date/time functions to manipulate dates and times in different time zones. Use the ZoneId, LocalDateTime, ZonedDateTime, and DateTimeFormatter for all manipulation, parsing, and stringification.

So how should I best store and retrieve shift data like ShiftStart and ShiftEnd?

If my ShiftStart is 8:00am in Daylights Saving, I need it to still be 8:00am outside of Daylights Savings. My UTC time range I pull would change by an hour.

My shift times are the constant in the local times. Some how I need to marry up the shift times with a date to get my full date object.

Parse to a LocalDateTime, actual date + shift start/end time. Convert to a ZonedDateTime by applying the ZoneId. That can be converted to the UTC-under-the-hood java.util.Date that Ignition uses everywhere when sending timestamps to tag history or other Ignition APIs. Just don't print those anywhere. Only use the DateTimeFormatter to print in specific time zones.