本文整理汇总了Java中java.util.GregorianCalendar.before方法的典型用法代码示例。如果您正苦于以下问题:Java GregorianCalendar.before方法的具体用法?Java GregorianCalendar.before怎么用?Java GregorianCalendar.before使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.GregorianCalendar
的用法示例。
在下文中一共展示了GregorianCalendar.before方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filteringBy
import java.util.GregorianCalendar; //导入方法依赖的package包/类
/**
* This method ask the user to input the time.
* @param array.
*/
@SuppressWarnings("resource")
public void filteringBy(ArrayList<Wifi> array) throws InputException{
System.out.println("Input the beginning of the period of time please : yyyy-mm-dd hh:mm:ss :");
String time_begining = new Scanner(System.in).nextLine();
System.out.println("Input the end of the period of time please : yyyy-mm-dd hh:mm:ss :");
String time_end = new Scanner(System.in).nextLine();
if (time_begining.length() == 19 && time_end.length() == 19) {
GregorianCalendar dateBegining = stringToDate(time_begining);
GregorianCalendar dateEnd = stringToDate(time_end);
if (dateBegining.before(dateEnd)) {
new WriteKmlTime(array, dateBegining, dateEnd);
}
else throw new InputException("Wrong input on the time, the begining time is after the end time.");
}
else throw new InputException("Wrong input on the time.");
}
示例2: Test4035301
import java.util.GregorianCalendar; //导入方法依赖的package包/类
public void Test4035301() {
GregorianCalendar c = new GregorianCalendar(98, 8, 7);
GregorianCalendar d = new GregorianCalendar(98, 8, 7);
if (c.after(d)
|| c.after(c)
|| c.before(d)
|| c.before(c)
|| !c.equals(c)
|| !c.equals(d)) {
errln("Fail");
}
}