Examples: TimeDifference method

This script checks to see if a document has been modified within the last seven days. If it hasn't, it mails a reminder memo to the document authors.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim newDoc As NotesDocument
Dim weekDateTime As NotesDateTime
Dim modifiedDateTime As NotesDateTime
Set db = session.CurrentDatabase
Set doc = session.DocumentContext
Set weekDateTime = New NotesDateTime( "Today" )
Set modifiedDateTime = New NotesDateTime( "" )
Call weekDateTime.AdjustDay( -7 )  ' set to one week ago
modifiedDateTime.LSLocalTime = doc.LastModified
If weekDateTime.TimeDifference( modifiedDateTime ) > 0  Then
  Set newDoc = New NotesDocument( db )
  newDoc.Form = "Memo"
  newDoc.Subject = _
  "Reminder: please update your project plan"
  Call newDoc.Send( False, doc.Authors )
End If