×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Hi Troy

You would need to program aroud it to achieve what you want.  I would store a 
time zone adjustment for each user in a different time zone to the AS/400 and 
then use a sub-procedure in a service program to adjust the timestamp whenever 
you need to.  The following should work for you:

Physical File (TZFILE)
=======
     A          R TZRECORD            
     A*                               
     A            TZUSER        10    
     A            TZADJ          4S 0 
     A*                               
     A          K TZUSER              


Service Program (TZPROC)
==========
 * ************************************************************************
 * * Procedure: TimeZone - Return users local time according to their      
 * *                       "time zone"                                     
 * ************************************************************************
                                                                           
H NoMain Option(*NoDebugIo:*SrcStmt)                                       
                                                                           
FTZFile    IF   E           K Disk                                         
                                                                           
D PgmDs          SDS                                                       
D  CurrentUser          254    263                                         
                                                                           
D TimeZone        pr              z                                        
D   TimeZoneUser                10                                         
                                                                           
 * ------------------------------------------------------------------------
                                                                           
P TimeZone        b                   Export                               
                                                                           
D TimeZone        pi              z                                       
D   TimeZoneUser                10                                        
                                                                          
D CurrentTime     s               z                                       
                                                                          
D   Hrs           s              2S 0                                     
D   Mins          s              2S 0                                     
                                                                          
 * Retrieve the current system date and time (Timestamp)...               
C                   Time                    CurrentTime                   
                                                                          
 * Check the TimeZone user file to see if a record exists...              
C     TimeZoneUser  Chain(E)  TZFile                                      
                                                                          
 * If no record found then the time zone offset will be zero...           
C                   If        %Found                                      
                                                                          
 * Note, the TimeZone adjustment is in HHMM form and is the adjustment to 
 * the "local" system time, not GMT/UCT...                                
C                   Eval      Hrs = TzAdj / 100                           
C                   Eval      Mins = TzAdj - (Hrs * 100)
                                                        
C                   AddDur    Hrs :*Hours   CurrentTime 
C                   AddDur    Mins:*Minutes CurrentTime 
C                   EndIf                               
                                                        
C                   Return    CurrentTime               
                                                        
P TimeZone        e                                     

Usage Example (TZTEST)
=========
 * Define work variables...                             
D WorkTime        s               z                     
                                                        
D User1           s             10    Inz('TOM')        
D User2           s             10    Inz('DICK')       
D User3           s             10    Inz('HARRY')      
D User4           s             10    Inz('FRED')       
                                                        
 * Procedure Prototype...                               
D TimeZone        pr              z                     
D   TimeZoneUser                10                      
                                                        
 * Get Current Time and display it...                   
C                   Time                    WorkTime    
C     WorkTime      Dsply                               
                                                        
 * Get Time in Tom's time zone it...                    
C                   Eval      WorkTime = TimeZone(User1)
C     WorkTime      Dsply                               
                                                         
 * Get Time in Dick's time zone it...                    
C                   Eval      WorkTime = TimeZone(User2) 
C     WorkTime      Dsply                                
                                                         
 * Get Time in Harry's time zone it...                   
C                   Eval      WorkTime = TimeZone(User3) 
C     WorkTime      Dsply                                
                                                         
 * Get Time in Fred's time zone it...                    
C                   Eval      WorkTime = TimeZone(User4) 
C     WorkTime      Dsply                                
                                                         
C                   Eval      *INLR = *ON                
C                   Return                               

Results
=====
If file TZFILE holds the following records:

  TZUSER     TZADJ 
  DICK        100- 
  HARRY       600- 
  TOM         200  

Then the results would be:

DSPLY  2004-11-08-14.47.28.580000 (Current System Time)
DSPLY  2004-11-08-16.47.29.940000 (Tom - In time zone +02:00)
DSPLY  2004-11-08-13.47.30.519000 (Dick - In time zone -01:00)
DSPLY  2004-11-08-08.47.31.335000 (Harry - In time zone -06:00)
DSPLY  2004-11-08-14.47.31.925000 (Fred - In same time zone as AS/400)

Note, the TZADJ field is in HHMM format and is relative to the time zone that 
the AS/400's clock is set to.


Hope that helps

best regards

Jonathan
www.astradyne-uk.com

-----Original message-----
From: T.Bryant@xxxxxxxxxxxxxx
Date: Mon,  8 Nov 2004 05:55:22 +0000
To: RPG programming on the AS400 / iSeries rpg400-l@xxxxxxxxxxxx
Subject: Different Time Zones.

> Currently in Australia our machine is having to deal with five different 
> time zones.
> Is it possible to setup multiple time zones on the system?
> 
> So that code like this;
> 
>  C                   TIME                    VHFINT 
> 
> won't have to be changed when run by a user in another time zone.
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Troy Bryant 
> Analyst Programmer
> Patrick Autocare.
> Phone: +61 03 9926 9913
> Fax: +61 03 9926 9977
> Mobile: +61 0408 397 333
> T.Bryant@xxxxxxxxxxxxxx
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
> 


Jonathan Mason
www.astradyne-uk.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.