本文整理匯總了Java中javax.xml.bind.DatatypeConverter.printDateTime方法的典型用法代碼示例。如果您正苦於以下問題:Java DatatypeConverter.printDateTime方法的具體用法?Java DatatypeConverter.printDateTime怎麽用?Java DatatypeConverter.printDateTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.bind.DatatypeConverter
的用法示例。
在下文中一共展示了DatatypeConverter.printDateTime方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testISO8601
import javax.xml.bind.DatatypeConverter; //導入方法依賴的package包/類
@Test
public void testISO8601() throws Exception {
User u1 = new User();
u1.setUsername("u1");
u1.setCreatedDate(Calendar.getInstance());
User u2 = new User();
u2.setUsername("u2");
Calendar future = Calendar.getInstance();
future.set(Calendar.YEAR, 3000);
u2.setCreatedDate(future);
System.out.println("createdDate lt "+Calendar.getInstance().getTimeInMillis());
ELFilterImpl el = new ELFilterImpl("createdDate lt "+Calendar.getInstance().getTimeInMillis());
List<User> r = (List<User>) el.filter(Arrays.asList(u1, u2));
assertNotNull(r);
assertEquals(1, r.size());
assertEquals("u1", r.get(0).getUsername());
System.out.println("createdDate lt \""+ DatatypeConverter.printDateTime(Calendar.getInstance())+"\"");
el = new ELFilterImpl("createdDate lt \""+ DatatypeConverter.printDateTime(Calendar.getInstance())+"\"");
r = (List<User>) el.filter(Arrays.asList(u1, u2));
assertNotNull(r);
assertEquals(1, r.size());
assertEquals("u1", r.get(0).getUsername());
}