本文整理匯總了Java中org.apache.pdfbox.util.DateConverter類的典型用法代碼示例。如果您正苦於以下問題:Java DateConverter類的具體用法?Java DateConverter怎麽用?Java DateConverter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DateConverter類屬於org.apache.pdfbox.util包,在下文中一共展示了DateConverter類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testDateConversion
import org.apache.pdfbox.util.DateConverter; //導入依賴的package包/類
/**
* Test that will show when the workaround is in place.
*/
public void testDateConversion() throws Exception {
Calendar c = DateConverter.toCalendar("D:20050526205258+01'00'");
assertEquals(2005, c.get(Calendar.YEAR));
assertEquals(05-1, c.get(Calendar.MONTH));
assertEquals(26, c.get(Calendar.DAY_OF_MONTH));
assertEquals(20, c.get(Calendar.HOUR_OF_DAY));
assertEquals(52, c.get(Calendar.MINUTE));
assertEquals(58, c.get(Calendar.SECOND));
//assertEquals(0, c.get(Calendar.MILLISECOND));
}
示例2: toDate
import org.apache.pdfbox.util.DateConverter; //導入依賴的package包/類
@SneakyThrows
private Date toDate(String cosVal) {
if (cosVal == null) {
return null;
}
String strippedDate = cosVal.replace("^D:", "");
Calendar cal = null;
cal = DateConverter.toCalendar(strippedDate);
return cal == null ? null : cal.getTime();
}