本文整理了Java中org.fujion.common.DateUtil.toDate()
方法的一些代码示例,展示了DateUtil.toDate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。DateUtil.toDate()
方法的具体详情如下:
包路径:org.fujion.common.DateUtil
类名称:DateUtil
方法名:toDate
[英]Converts day, month, and year to a date.
[中]将日、月和年转换为日期。
代码示例来源:origin: org.fujion/fujion-common
/**
* Converts day, month, and year to a date.
*
* @param day Day of month.
* @param month Month (1=January, etc.)
* @param year Year (4 digit).
* @return Date instance.
*/
public static Date toDate(int day, int month, int year) {
return toDate(day, month, year, 0, 0, 0);
}
代码示例来源:origin: org.fujion/fujion-common
@Test
public void testDateRange() {
DateRange dr = new DateRange("test|12-Jul-2010|15-Aug-2010");
assertEquals(dr.getStartDate(), DateUtil.toDate(12, 7, 2010));
assertEquals(dr.getEndDate(), DateUtil.toDate(15, 8, 2010));
assertTrue(dr.inRange(DateUtil.toDate(1, 8, 2010)));
assertFalse(dr.inRange(DateUtil.toDate(15, 8, 2010)));
assertTrue(dr.inRange(DateUtil.toDate(15, 8, 2010), true, true));
assertFalse(dr.inRange(DateUtil.toDate(15, 8, 2010, 13, 30, 0), true, true));
assertFalse(dr.inRange(DateUtil.toDate(16, 8, 2010), true, true));
}
代码示例来源:origin: org.fujion/fujion-common
@Test
public void testAge() {
Date dob = DateUtil.toDate(27, 7, 1958);
Date ref = DateUtil.toDate(1, 1, 2013);
assertEquals("54 yrs", DateUtil.formatAge(dob, true, ref));
assertEquals("54 yr", DateUtil.formatAge(dob, false, ref));
dob = DateUtil.toDate(15, 12, 2012);
assertEquals("17 days", DateUtil.formatAge(dob, true, ref));
dob = DateUtil.toDate(30, 10, 2012);
assertEquals("2 mos", DateUtil.formatAge(dob, true, ref));
}
内容来源于网络,如有侵权,请联系作者删除!