PxPlus User Forum

Twitter Twitter Twitter

Author Topic: client time  (Read 1994 times)

John DeStefano

  • New Member
  • *
  • Posts: 1
    • View Profile
client time
« on: September 19, 2018, 05:13:52 PM »
Hi all,

We are using the function dte(0) to print the time on some forms and reports.  We also use it to capture and record events in data files.

e.g.  dte(0:"%hz:%mz %P")

We have a customer that has locations in multiple time zones.  The dte(0) function uses the server time.  We have users logged into the server with their client in a different time zone.

Is there a function that will return the client time and not the server time?

We are using PXPlus 13.10 running on a Windows Server 2012 and we are not using WINDX. Users connect to the server using an RDP connection.


Devon Austen

  • Administrator
  • Diamond Member
  • *****
  • Posts: 382
  • Don’t Panic
    • View Profile
    • PVX Plus Technologies
Re: client time
« Reply #1 on: September 20, 2018, 08:51:10 AM »
Have you tried:

Code: [Select]
EXECUTE "[WDX]dte(0:"%hz:%mz %P")"
or if the code also needs to run not on windx

Code: [Select]
EXECUTE "[LCL]dte(0:"%hz:%mz %P")"
Principal Software Engineer for PVX Plus Technologies LTD.

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: client time
« Reply #2 on: September 20, 2018, 09:18:59 AM »
Since you are using RDP and not WindX I don't know of anyway to find the users true workstation time zone.  When you connect using RDP the processes all run on your server and all the workstation does is handle display/input.  There is no real way to run anything locally to determine the time zone.

Now there may be an Windows API you could call in the windows WTS library ( https://docs.microsoft.com/en-us/windows/desktop/api/Wtsapi32/ ) but I did a quick look and couldn't see anything that would provide you what you are looking for.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Devon Austen

  • Administrator
  • Diamond Member
  • *****
  • Posts: 382
  • Don’t Panic
    • View Profile
    • PVX Plus Technologies
Re: client time
« Reply #3 on: September 20, 2018, 09:32:30 AM »
I missed that you were not using Windx but RDP. What I suggested would only work if you are using WindX.

Mike is right that there is no easy way to get the client time when everything is running on the server except the RDP client.
Principal Software Engineer for PVX Plus Technologies LTD.

David Reynolds

  • Member
  • **
  • Posts: 14
    • View Profile
Re: client time
« Reply #4 on: September 20, 2018, 10:23:45 AM »
I'm not sure if there's a Windows equivalent, but on Linux we use something like this...

Each user is assigned a location, and each location is assigned a time zone (matching those in /usr/share/zoneinfo)
So for local time we just issue:

Code: [Select]
READ RECORD("| TZ="+TZ$+" date +%Y%m%d%H%M%S")USERTIME$

where
Code: [Select]
TZ$="Canada/Pacific" ! or Canada/Mountain or Canada/Central or America/Toronto or Greenwich etc

Mike King

  • Diamond Member
  • *****
  • Posts: 3810
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: client time
« Reply #5 on: September 20, 2018, 12:38:48 PM »
A quick scan of the internet turned up the following link which may be of help to you:

https://serverfault.com/questions/634260/set-user-time-zone-by-gpo-on-windows-server-2012

It looks like you can configure the server to logically change the time for the session running on the host to that of the workstation (or at least that is how I interpreted this).
Of course now the problem may be for you to get the time zone of the host  ;D
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com