本文整理匯總了Java中java.time.ZonedDateTime.withNano方法的典型用法代碼示例。如果您正苦於以下問題:Java ZonedDateTime.withNano方法的具體用法?Java ZonedDateTime.withNano怎麽用?Java ZonedDateTime.withNano使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.time.ZonedDateTime
的用法示例。
在下文中一共展示了ZonedDateTime.withNano方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: nowGasDay
import java.time.ZonedDateTime; //導入方法依賴的package包/類
public static ZonedDateTime nowGasDay() {
final ZonedDateTime now = ZonedDateTime.now(ZoneOffset.UTC);
now.withHour(6);
now.withMinute(0);
now.withSecond(0);
now.withNano(0);
return now;
}
示例2: test_withNanoOfSecond_normal
import java.time.ZonedDateTime; //導入方法依賴的package包/類
@Test
public void test_withNanoOfSecond_normal() {
ZonedDateTime base = ZonedDateTime.of(TEST_LOCAL_2008_06_30_11_30_59_500, ZONE_0100);
ZonedDateTime test = base.withNano(15);
assertEquals(test, ZonedDateTime.of(TEST_LOCAL_2008_06_30_11_30_59_500.withNano(15), ZONE_0100));
}
示例3: test_withNanoOfSecond_noChange
import java.time.ZonedDateTime; //導入方法依賴的package包/類
@Test
public void test_withNanoOfSecond_noChange() {
ZonedDateTime base = ZonedDateTime.of(TEST_LOCAL_2008_06_30_11_30_59_500, ZONE_0100);
ZonedDateTime test = base.withNano(500);
assertEquals(test, base);
}