1、使用jre自带的ManagementFactory类获取
java.lang.management.ManagementFactory.getRuntimeMXBean().getStartTime()
2、在WEB监听器/定时器中定义时间戳变量
public class TimerListener implements ServletContextListener {public static final long StartTime = System.currentTimeMillis();@Overridepublic void contextDestroyed(ServletContextEvent arg0) {//xxxx}
}
以上方法都为时间戳,需要通过转换成yyyyMM等格式。