Domino Code Fragment

Code Name*
TimeZone property
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.139.81.58
Description*
This agent prints the time zone in the creationDateSaved item of each document in the current database.
Type*
Java
Categories*
Date/Time Handling
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import lotus.notes.*;
import java.util.*;


public class timezoneagent extends AgentBase
{
 public void NotesMain()
 {
   try
   {
     Session s = getSession();
     AgentContext ac = s.getAgentContext();
     Database db = ac.getCurrentDatabase();
     DocumentCollection dc = db.getAllDocuments();
     Document doc;
     for (int j=0; j<dc.getCount(); j++)
     {
       doc = dc.getNthDocument(j+1);
       Vector dtv = doc.getItemValue("creationDateSaved");
       DateTime cds = (DateTime)dtv.firstElement();
       int zone = cds.getTimeZone();
       System.out.println
       (doc.getItemValue("Subject") +
       " was created in time zone " + zone);
     }
   }
   catch (Exception e)
   {
     e.printStackTrace();
   }
 }
}