ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaha_5.4.0.1/gettime.htm

135 lines
7.7 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="concept" />
<meta name="DC.Title" content="Time zone configuration" />
<meta name="abstract" content="When you have Java programs that are sensitive to time zones, you should configure the time zone on your server so that your Java programs use the correct time." />
<meta name="description" content="When you have Java programs that are sensitive to time zones, you should configure the time zone on your server so that your Java programs use the correct time." />
<meta name="DC.Relation" scheme="URI" content="international.htm" />
<meta name="DC.Relation" scheme="URI" content="charenc.htm" />
<meta name="DC.Relation" scheme="URI" content="crtinter.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="gettime" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Time zone configuration</title>
</head>
<body id="gettime"><a name="gettime"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Time zone configuration</h1>
<div><p>When you have Java™ programs that are sensitive to time
zones, you should configure the time zone on your server so that your Java programs
use the correct time.</p>
<p>To determine the local time correctly, the Java virtual machine (JVM) requires that
you set both the QUTCOFFSET <span class="keyword">i5/OS™</span> system
value and the time of day information in the LOCALE user parameter for the
current user or job:</p>
<ul><li>The JVM determines the correct Coordinated Universal Time (UTC) by comparing
the QUTCOFFSET value to the local time for the system </li>
<li>The JVM returns the correct local time to the system by using the Java system
property user.timezone.</li>
</ul>
<div class="note"><span class="notetitle">Note:</span> An alternative to setting QUTCOFFSET and LOCALE is to use
the QTIMZON system value. The JVM looks to the system QLOCALE object first.
If not found, the JVM will then look at the QTIMZON system value. If the
QTIMZON system value contains a non-recognized QTIMZON object, the JVM defaults
user.timezone to UTC.</div>
<div class="section"><h4 class="sectiontitle">QUTCOFFSET and user.timezone</h4><p>The QUTCOFFSET <span class="keyword">i5/OS</span> system value represents the
Coordinated Universal Time (UTC) Offset for your system. QUTCOFFSET specifies
the difference in time between UTC (or Greenwich mean time) and the current
system time. The default value for QUTCOFFSET is zero (+00:00).</p>
<p>The
QUTCOFFSET value allows the JVM to determine the correct value for the local
time. For example, the value for QUTCOFFSET to specify central standard time
(CST) is -6:00. To specify central daylight time (CDT), QUTCOFFSET has a value
of -5:00.</p>
<p>The user.timezone Java system property uses UTC time as the
default value. Unless you specify a different value, the JVM recognizes UTC
time as the current time.</p>
<p>For more information about QUTCOFFSET and Java system
properties, see the following topics:</p>
<blockquote> <p><a href="../rzakz/rzakzqutcoffset.htm" target="_blank"><span class="keyword">i5/OS</span> system
value: QUTCOFFSET</a></p>
<p><a href="sysprop.htm">Java system
properties</a></p>
</blockquote>
</div>
<div class="section"><h4 class="sectiontitle">LOCALE</h4><p>The LOCALE parameter on a user profile specifies
the *LOCALE object to use for the LANG environment variable. Do not confuse
the *LOCALE object with Java locales.</p>
<p>Correctly setting the
locale information allows the JVM to set the user.timezone property to the
correct time zone. You can set the user.timezone property to override the
default setting provided by the *LOCALE object.</p>
<p>For more information
about using locales and setting Java system properties, see the following
pages:</p>
<blockquote> <p><a href="../nls/rbagslocaleover.htm" target="_blank">Locales</a></p>
<p><a href="sysprop.htm">Java system
properties</a></p>
</blockquote>
<p>The LC_TOD category defines rules for daylight
savings time and time zone information for a locale.</p>
<div class="note"><span class="notetitle">Note:</span> To use daylight
savings time, you must adjust the QUTCOFFSET system value to have the correct
offset.</div>
<p>The following example shows the LC_TOD category information
that you must include in the locale object in order to configure the correct
time zone for Java:</p>
<pre> LC_TOD
% TZDIFF is number of minutes difference from UTC (or GMT)
tzdiff 360
% Timezone name (this is the value that you would have
% passed to the JVM as the user.timezone property.)
tname "&lt;C&gt;&lt;S&gt;&lt;T&gt;"
% Remember to adjust the value of QUTCOFFSET when using
% daylight savings time (DST)
% Name used for DST.
dstname "&lt;C&gt;&lt;D&gt;&lt;T&gt;"
% DST start in this part of the US is the first Sunday in
% April at 2am
dststart 4,1,1,7200
% DST End in this area of US is Last Sunday in October.
dstend 10,-1,1,7200
% shift in seconds
dstshift 3600
END LC_TOD</pre>
<p>The LC_TOD category of the locale contains the
tname field, which you must set to the same value as your time zone. For valid
time zone strings, refer to the Javadoc reference information for the java.util.TimeZone
class. For more information about working with locales, see the following
pages:</p>
<blockquote> <p><a href="../nls/rbagslocale.htm" target="_blank">Work
with locales</a></p>
<p><a href="javaapi/api/java/util/TimeZone.html" target="_blank">TimeZone Javadoc reference information</a></p>
</blockquote>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="international.htm" title="You can customize your Java programs for a specific region of the world by creating internationalized Java program. By using time zones, locales, and character encoding, you can ensure that your Java program reflects the correct time, place, and language.">Internationalization</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="charenc.htm" title="Java programs can convert data in different formats, enabling your applications to transfer and use information from many kinds of international character sets.">Java character encodings</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="crtinter.htm" title="If you need to customize a Java program for a specific region of the world, you can create an internationalized Java program with Java locales.">Examples: Creating an internationalized Java program</a></div>
</div>
</div>
</body>
</html>