Examples: GMTTime property (NotesDateTime - LotusScript®)

  1. This script displays the value of the GMTTime property.
    Dim dateTime As New NotesDateTime( "04/16/96 05:36 PM" )
    Messagebox( dateTime.GMTTime )
    • If the script runs on a computer set to Eastern Standard Time and daylight-saving time is observed, the dateTime object has a TimeZone property equal to 5, so the GMTTime property returns the string "04/16/96 09:36:00 PM GMT."
    • If the script runs on a computer set to Bering Standard Time, the dateTime object has a TimeZone property equal to 11, so the GMTTime property returns the string "04/17/96 03:36:00 AM GMT."
  2. This script creates a Branch Office Report document using a collection of documents created by users from several different time zones. The PostedDate item on each document indicates when it was posted and in what time zone; the Event item indicates what event is being reported. You want the Body of the Branch Office Report to show the PostedDate of each document in a single time zone, so you use the GMTTime property to convert each date-time to Greenwich Mean Time.
    Sub Initialize
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim collection As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim report As NotesDocument
      Dim reportBody As NotesRichTextItem
      Dim item As NotesItem
      Dim dateTime As NotesDateTime
      Set db = session.CurrentDatabase
      Set collection = db.FTSearch("GMTTime",0)
      Set doc = Collection.GetFirstdocument()
      Set report = New NotesDocument( db )
      Set reportBody = New NotesRichTextItem( report, "Body" )
      report.Form = "Branch Office Report"
      While Not(doc Is Nothing)
        Set item = doc.GetFirstItem( "PostedDate" )
        Set dateTime = item.DateTimeValue
        Call reportBody.AppendText( dateTime.GMTTime )
        Call reportBody.AppendText( " " )
        Call reportBody.AppendText( doc.Event( 0 ) )
        Call reportBody.AddNewLine( 1 )
        Set doc = collection.GetNextDocument(doc)
      Wend
      Call report.Save( True, True )
    End Sub

    For example, if there are three documents in the collection created in Greenwich Mean Time, Pacific Standard Time, and Central Standard Time, respectively, the body of the Report might look like this:

    08/06/95 06:12:14 PM GMT London office posts results

    08/06/95 06:17:11 PM GMT San Francisco office obtains proposal

    08/06/95 08:50:58 PM GMT Chicago office receives sketches