惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
The Register - Security
The Register - Security
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The GitHub Blog
The GitHub Blog
博客园 - 司徒正美
罗磊的独立博客
U
Unit 42
S
SegmentFault 最新的问题
Y
Y Combinator Blog
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
J
Java Code Geeks
Schneier on Security
Schneier on Security
Know Your Adversary
Know Your Adversary
C
Check Point Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Simon Willison's Weblog
Simon Willison's Weblog
V
Vulnerabilities – Threatpost
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
阮一峰的网络日志
阮一峰的网络日志
The Hacker News
The Hacker News
博客园 - 叶小钗
C
Cybersecurity and Infrastructure Security Agency CISA
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Latest news
Latest news
L
Lohrmann on Cybersecurity
A
About on SuperTechFans
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
S
Securelist
A
Arctic Wolf
D
Darknet – Hacking Tools, Hacker News & Cyber Security
T
Threatpost
Scott Helme
Scott Helme
博客园 - 聂微东
博客园 - 【当耐特】
T
Tenable Blog
I
Intezer
D
DataBreaches.Net
B
Blog RSS Feed
Security Latest
Security Latest
C
Cisco Blogs
T
Tor Project blog
N
Netflix TechBlog - Medium

Comments for IT Jungle

Set Your Library List From A Job Description - IT Jungle GenAI Is The Death Of Deterministic Project Budgeting - IT Jungle Guru: Single Threading A Program Execution - IT Jungle Guru: Where’s The Table? - IT Jungle Big Blue Unveils Bob Premium Pack For IBM i - IT Jungle Guru: SQL Sequences In RPG Let Db2 Handle The Counting - IT Jungle DB2 for i 7.2 Features and Fun, Part 1 - IT Jungle Guru: DateTime Rules Of Thumb - IT Jungle Spring IBM i Tech Refreshes Will Come A Bit Later This Year - IT Jungle As I See It: The Surgical Years - IT Jungle After A Few Short Years, VS Code Passes Rational Developer for i - IT Jungle Guru: Managing The Lifecycle Of Your Service Programs – Updates Without Chaos - IT Jungle Where We Are And Where We Are Headed With AI On IBM i - IT Jungle And Then There Were Two: Big Blue Withdraws IBM i 7.4 - IT Jungle Guru: When Attention Turns To You – Writing Your Own ATTN Program - IT Jungle With Power11, Power Systems "Go To Eleven" - IT Jungle With Subscription Price, IBM i P20 And P30 Tiers Get Bigger Bundles - IT Jungle Guru: SQL and QTEMP - IT Jungle Guru: Ready or Not! Part 2 of Big Changes in RDi V9.6, Hover and Annotations - IT Jungle
Present Timestamps in the Local Time Zone - IT Jungle
Michael Sansoterra · 2026-06-19 · via Comments for IT Jungle

The code for this article is available for download.

For companies with locations in multiple time zones that connect to a central iSeries, time stamp presentation can be a problem. For instance, consider a legacy shipping application that records the date and time of a shipment. If the legacy application isn’t time zone aware, the shipments at the various locations will all be stamped with the date and time of the system’s time zone. A desirable solution for this problem would be a routine that can adjust a timestamp from the main time zone to a local time zone.

Fortunately the “Convert Date and Time Format” (QWCCVTDT) API can help. As of V5R3, this API is capable of converting a timestamp from one time zone to another. RPG service program ADJTS, which you can see by clicking here, shows sample subprocedure ADJTIMESTAMP that uses this API for time zone conversion. The subprocedure’s parameters are: an input timestamp, the input timestamp’s time zone followed by the output time zone. The subprocedure returns the timestamp adjusted for the requested time zone.

Here is a free form example that converts the current date and time to Atlantic Standard Time:

AdjustedTime=AdjTimeStamp(%Timestamp:
                          '*SYS':'QN0400AST');

The input/output time zones are the names of time zone (*TIMZON) objects that define the time zone’s name, offset from Coordinated Universal Time (UTC) and daylight savings information. The predefined IBM time zones can be viewed by issuing the WRKTIMZON command or by clicking here. Here are a few examples of the default time zone values:

*TIMZON Name

Offset

Description

Q0000UTC

0:00

Coordinated Universal Time (UTC)

Q0000GMT

0:00

Greenwich Mean Time (GMT)

QN0400AST

-4:00

Atlantic Standard Time (AST)

QN0500EST

-5:00

Eastern Standard Time (EST)

QN0500EST2

-5:00

Eastern Standard Time (EST)

QN0600CST

-6:00

Central Standard Time (CST)

QN0700MST

-7:00

Mountain Standard Time (MST)

QN0700MST2

-7:00

Mountain Standard Time (MST)

QN0700T

-7:00

Mountain Standard Time (T)

QN0800PST

-8:00

Pacific Standard Time (PST)

QN0800U

-8:00

Pacific Standard Time (U)

QN0900AST

-9:00

Alaska Standard Time (AST)

If for some reason IBM doesn’t have one defined to fit your needs, you can create a *TIMZON object with the CRTTIMZON command.

In addition to these pre-defined time zones, the following special values are allowed by the API:

  • *SYS — System Time Zone
  • *UTC — Coordinated Universal Time
  • *JOB — The current job’s defined time zone

This subprocedure can be wrapped with a myriad of related signatures (i.e. parameter lists) to meet any number of variations. For example, a wrapper can be created to accept a numeric date and a numeric time from a legacy application. These two pieces of information can be combined into a timestamp to call the base AdjTimeStamp subprocedure.

For SQL users, an SQL CREATE FUNCTION statement can be used as follows to make the function available to SQL:

Create Function xxxxx/AdjTS 
(parmTimeStamp   Timestamp, 
 parmInTimeZone  Char(10), 
 parmOutTimeZone Char(10)) 
Returns TimeStamp 
Language RPGLE 
External Name 'xxxxx/ADJTS(ADJTIMESTAMP)' 
Parameter Style General 

The function could be used in SQL to convert a timestamp from the system’s time zone to Eastern Standard Time as follows:

Select AdjTS(Timestamp('2006-10-02 10:25:30'),        
       Char('*SYS'),Char('QN0500EST')) 
  From SysIBM/SysDummy1

In order to implement this function, an application would need a way to track time zone by user or location. One approach is to store all of the date and time information in a single base time zone such as Coordinated Univeral Time (UTC) or the central system’s default time zone. The time zone adjustment subprocedure would be used to adjust a timestamp for display purposes. It would also be used to adjust user input to convert it back to the application’s base time zone. A second approach would be to record a time stamp in its native time zone along with the time zone indicator so that it could be properly converted to any other time zone when appropriate.

Applications can quickly jump time zone boundaries for localized date and time display with the use of the QWCCVTDT API.