1.jsp中如何用if语句设置时间段
你的比较肯定要把日期也算进去
18.30到第二天上午的6.30
Date(int year, int month, int 1, int 18, int 30) -Date(int year, int month, int 2, int 6, int 30)
再:date1.compareTo(date2);
compareTo
public int compareTo(Date anotherDate)比较两个日期的顺序。
指定者:
接口 Comparable<Date>; 中的 compareTo
参数:
anotherDate - 要比较的 Date。
返回:
如果参数 Date 等于此 Date,则返回值 0;如果此 Date 在 Date 参数之前,则返回小于 0 的值;如果此 Date 在 Date 参数之后,则返回大于 0 的值。
抛出:
NullPointerException - 如果 anotherDate 为 null。
转载请注明出处育才学习网 » jsp中if语句怎么写