本文整理匯總了Java中java.time.format.DateTimeFormatter.ISO_LOCAL_DATE_TIME屬性的典型用法代碼示例。如果您正苦於以下問題:Java DateTimeFormatter.ISO_LOCAL_DATE_TIME屬性的具體用法?Java DateTimeFormatter.ISO_LOCAL_DATE_TIME怎麽用?Java DateTimeFormatter.ISO_LOCAL_DATE_TIME使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.time.format.DateTimeFormatter
的用法示例。
在下文中一共展示了DateTimeFormatter.ISO_LOCAL_DATE_TIME屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
public static void main(String[] args) {
DateTimeFormatter formatter1 = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM);
DateTimeFormatter formatter2 = DateTimeFormatter.ofLocalizedTime(FormatStyle.FULL);
DateTimeFormatter formatter3 = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG);
DateTimeFormatter formatter4 = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT, FormatStyle.SHORT);
DateTimeFormatter formatter5 = DateTimeFormatter.BASIC_ISO_DATE;
// 2057-08-11
DateTimeFormatter isoLocalDate = DateTimeFormatter.ISO_LOCAL_DATE;
DateTimeFormatter isoDate = DateTimeFormatter.ISO_DATE;
// 14:30:15.312
DateTimeFormatter isoTime = DateTimeFormatter.ISO_TIME;
DateTimeFormatter isoLocalTime = DateTimeFormatter.ISO_LOCAL_TIME;
// 2050-08-11T14:30:15.312
DateTimeFormatter isoDateTime = DateTimeFormatter.ISO_DATE_TIME;
DateTimeFormatter isoLocaDateTime = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
}
示例2: testWithoutZoneWithoutOffset
@Test(dataProvider="parseWithoutZoneWithoutOffset")
public void testWithoutZoneWithoutOffset(String ldtString, LocalDateTime expectedLDT) {
dtFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
ldt1 = LocalDateTime.parse(ldtString, dtFormatter);
assertEquals(expectedLDT, ldt1);
}