Knowledge Base
Showing results for 
Search instead for 
Did you mean: 

Display local server time PE Script example


Provide a solution for displaying local server time



Automation Server

Enterprise Server


Request to display local server time


Example code below can be inserted into a PE Script to allow display of local server time from within the workstation. By converting the time into a string the display of the information is not affected by any localization that is attempted by the client.


datetime output ServerTime, ClientDisplayTime
string output DisplayTimeString, DisplayTimeString2
String ampm

numeric h1, h2
numeric Adjustment

' Time Adjustment: UTC Offset, DayLight Savings Time
Adjustment = 4*3600

ServerTime = Time

'Set the desired Client Display Time
ClientDisplayTime = ServerTime + Adjustment

'Set String to ServerTime
print ServerTime to DisplayTimeString

h1 = TimePiece(hour, ServerTime)
if h1 = 24 then h1 = 12

if h1 > 12 then
 h2 = h1-12
 ampm = "PM"
 h2 = h1
 ampm = "AM"

print TimePiece(month, ServerTime);"/" ;~
      TimePiece(dayofmonth, ServerTime);"/";~
      TimePiece(year, ServerTime),~
      h2;":"; ~
      TimePiece(minute, ServerTime);":";~
      TimePiece(second, ServerTime), ampm to DisplayTimeString2


Tags (1)
Labels (1)
Version history
Revision #:
1 of 1
Last update:
‎2018-09-06 10:14 AM
Updated by: