carpentercr

Display server time instead of client time in visual studio

Discussion created by carpentercr on Jul 9, 2013
Latest reply on Jul 12, 2013 by charlie@osisoft.com
The simple VB code below displays the current snapshot value of a tag.  The server is in central time zone and I am in eastern time zone.  When I run this vb app from my pc, the time displayed is the time in eastern, not central.  I would like to display the times in the same time zone as the server.  I am sure there is a simple way to do this, but I have not figured it out yet.

Option Explicit
Dim srv As Server
Dim piconst As PIConstant

 

Private Sub Form_Load()
'set the default server and clear the form
On Error GoTo handler
Set srv = Servers.DefaultServer

Dim pt As PIPoint
Dim pv As PIValue

'clear some fields
Text4.Text = ""
Text5.Text = ""

'set the points for the point classes
Set pt = srv.PIPoints("dpw:hl:pahts:BatchActive_L2")

' Get the snapshot of the current value for the pt point (batchactive) and put on screen
Set pv = pt.Data.Snapshot

Text4.Text = CStr(pv.Value)
Text5.Text = CStr(pv.TimeStamp.LocalDate)

Exit Sub
handler:
MsgBox Err.Description
End Sub

Outcomes