IBM Support

Using Locales to Change Time

Troubleshooting


Problem

This document includes information on using locales to adjust time displayed by a user profile.

Resolving The Problem

Assigning a locale to a user profile or job will not change the system time displayed. If you want to provide a separate time zone for each job or user profile, you must create your own applications to set up logic that changes the time the job is based on. There are APIs that can retrieve the time in various time zones; however, that will not help unless you change your programs to call them.

The major problem when working with this type of change is that many programs will take the local time (the output of the TIME op-code, or the various BIFs, or INZ(*SYS), and so on), and just write it to a file. For example, you might write the current time as the time an order was placed, or the time that a user logged on, or some sort of time when something happened. If your code is not designed to deal with times coming from multiple time zones, there would be a major problem with this. One job might write 14:45 to a log file, and 10 minutes later another job might write 11:55. Even though the 11:55 happened later, it was in a different time zone, so it appears as if it is 4 hours earlier. If the file is sorted by those times, you would have an even more serious problem.

Applications really need to be coded differently if they want to handle multiple time zones. The most common (and probably best) practice for these applications is that they store all dates/times in UTC. Then, whenever a date/time is displayed to a user, there is program code that adds or subtracts from that UTC date/time to get the right one for the user's time zones.

You may write routines to handle this logic, and then you put those routines into their own program(s) or service program(s) so that your applications can call them whenever they need to retrieve or display the time. That way, all of the logic is in one place. If you need to change it or extend it, you do not need to change hundreds of programs.

The following FAQ excerpt shows the way users can operate in different time zones without changing their applications:

Q: How can users operate in different time zones on one iSeries without changing our applications?

A: To get this level of support on the iSeries, you will need a system that supports partitions (LPARS) so that you can set up a separate partition for each time zone. You should assign user profiles to the partition for a group of users who will be working in the same time zone, and you should change the QTIME system value (CHSSYSVAL) to reflect the time in the time zone for each group of users. If you only want to change the hour and not the minutes or seconds, you may change the QHOUR system value for the partition.

[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"Platform":[{"code":"PF012","label":"IBM i"}],"Version":"6.1.0"}]

Historical Number

533653384

Document Information

Modified date:
11 November 2019

UID

nas8N1012793