当前位置: 代码迷 >> Lotus >> 取创建时间解决方案
  详细解决方案

取创建时间解决方案

热度:194   发布时间:2016-05-05 06:46:53.0
取创建时间
我要去文档的创建时间 根据创建时间排序 用Java代码怎么取创建时间啊??
------解决方案--------------------
文档随便建个域,创建时计算,@CREATED。不就有了吗
------解决方案--------------------
在JAVA代理中获取创建时间?
SimpleDateFormat s = new SimpleDateFormat("YY-MM-DD hh:mm:ss");
Vector createTime = doc.getItemValue("创建时间域名");
String createTimeStr = "";
if(createTime.size()!=0)
{
  createTimeStr = s.format(((DateTime)createTime.elementAt(0)).toJavaDate());
}
------解决方案--------------------
帮助里面都有,代码如下:

import lotus.domino.*;
import java.util.Vector;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Database db = agentContext.getCurrentDatabase();
      DocumentCollection dc = db.getAllDocuments();
      Document doc = dc.getFirstDocument();
      while (doc != null) {
        System.out.println(doc.getItemValueString("Subject"));
        System.out.println("\tCreated on " +
        doc.getCreated().getLocalTime());
        System.out.println("\tLast accessed on " +
        doc.getLastAccessed().getLocalTime());
        System.out.println("\tLast modified on " +
        doc.getLastModified().getLocalTime());
        doc = dc.getNextDocument(doc); }
  
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}

  相关解决方案