Adjust analysis times based on UTC
Issue: In LABWORKS 6.10, is there a way to automatically change analysis times based on a UTC value?
Solution: This is handled with a legacy VB6 program that uses the SQL function GETLOCALDATE.
- GETLOCALDATE gets the value of SYSMGRVAL where SYSMGROPT = ‘APPLICATION_TIME_ZONE’. This means that the function fetches the value of the system manager’s variable (SYSMGRVAL) associated with the application’s timezone setting (APPLICATION_TIME_ZONE).
- If the value for SYSMGROPT is blank, the database server’s local operating system (OS) time is used.
- The value for APPLICATION_TIME_ZONE is a string representing a timezone name from a timezone list.
- If the SYSMGROPT is not blank, the time is calculated using a UTC offset (Coordinated Universal Time offset).
The business objective for this feature was to use the database server’s time for consistency across the application. However, if the database server is in a different timezone, the time needs to be adjusted to account for this difference. A challenge with this approach is that when VB6 writes the date and time values to the database, it doesn’t include timezone information. As a result, users in multiple time zones will only see the time as the local time when the data was saved or updated, rather than the time adjusted for their specific timezone.