RE: Date & time problem in agent Karl-Henry Martinsson 25.Feb.13 11:45 AM a Web browser Applications Development All ReleasesAll Platforms
"It is a very old code near 2003-2004 and written by old developer, It was working fine some time ago.. therefore i can not change the code."
If it is working fine, you don't need to change it.
If it is not working fine, you must change it anyway.
Do you have some kind of rule at yrou company that you can only change one line of code, or just a certain number of characters?
Why not fix the code that the old (and obviously not too knowledgeble) developer wrote? You can remove some useless code anyway, there is for example no need to declare 'current' and to assign it a value of Now()...
Won't you agree that this code is much nicer, and easier to debug?
Dim session As New NotesSession
Dim view As NotesView
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim accessed As NotesDateTime
Set db = session.CurrentDatabase
Set view = db.GetView("AllDocument")
Set doc = view.GetFirstDocument
Set accessed = New NotesDateTime(doc.LastAccessed)
If accessed.LSLocalTime < Now() Then
MsgBox("Accessed more than 24 hours ago.")
MsgBox("Accessed less than 24 hours ago.")