Obtaining a Domino server's time

How do you get Domino server time? I tried the following code but it didn't work. Lotus Notes always uses local/workstation time when you use/define NotesDateTime. The easiest way to get a server's time is to use this code:
Function GetServerTime as variant 
Dim ses As New NotesSession 
Dim db As notesDatabase 
Dim doc As notesDocument 
Dim dt As Variant 
Set db = ses.currentDatabase 
Set doc = New NotesDocument(db) 
dt = doc.created 
Call doc.remove(True) 
GetServerTime = dt 
End function 

I would have used this expression:
Evaluate({@Now([SERVERTIME]; "}
 & db.server & {")}) 

But your way is also good. You don't need the call to doc.Remove. Since you never saved the document, just let the doc variable fall out of scope and there will not be a document created.

Do you have comments on this Ask the Expert question and response? Let us know.

This was first published in September 2004