jsp里面应该用哪个方法?access里的时间格式是怎样的?插入时如何转换格式?另外,在access里怎么比较两个时间的值,比如我想判断两个值的差是否超过一个小时,怎么做?

解决方案 »

  1.   

    // 取当前时间:
    Calendar cal = new GregorianCalendar();
    // Get the components of the time
    int hour12 = cal.get(Calendar.HOUR); // 0..11
    int hour24 = cal.get(Calendar.HOUR_OF_DAY); // 0..23
    int min = cal.get(Calendar.MINUTE); // 0..59
    int sec = cal.get(Calendar.SECOND); // 0..59
    int ms = cal.get(Calendar.MILLISECOND); // 0..999
    int ampm = cal.get(Calendar.AM_PM); // 0=AM, 1=PM // 取系统日期:
    Calendar cal = new GregorianCalendar();
    // Get the components of the date
    int era = cal.get(Calendar.ERA); // 0=BC, 1=AD
    int year = cal.get(Calendar.YEAR); // 2002
    int month = cal.get(Calendar.MONTH); // 0=Jan, 1=Feb, ...
    int day = cal.get(Calendar.DAY_OF_MONTH); // 1...
    int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);判断2个时间间隔,之间用时间相减.