Java Code Examples for java.time.temporal.ChronoField#HOUR_OF_DAY
The following examples show how to use
java.time.temporal.ChronoField#HOUR_OF_DAY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FHIRPathUtil.java From FHIR with Apache License 2.0 | 6 votes |
private static ChronoField getPrecision(String text) { if (text.endsWith("T")) { return ChronoField.DAY_OF_YEAR; } String time = text.contains("T") ? text.substring(text.indexOf("T") + 1) : text; if (time.contains("+") || time.contains("-") || time.endsWith("Z")) { return ChronoField.OFFSET_SECONDS; } int count = count(time, ':'); switch (count) { case 0: return ChronoField.HOUR_OF_DAY; case 1: return ChronoField.MINUTE_OF_HOUR; case 2: return ChronoField.MICRO_OF_SECOND; } throw new IllegalArgumentException(text); }
Example 2
Source File: TestChronoField.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 3
Source File: TestChronoField.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 4
Source File: TestChronoField.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 5
Source File: TestChronoField.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 6
Source File: TestChronoField.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 7
Source File: TestChronoField.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 8
Source File: TestChronoField.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 9
Source File: TestChronoField.java From hottub with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 10
Source File: TestChronoField.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 11
Source File: TestChronoField.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 12
Source File: TestChronoField.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 13
Source File: TestChronoField.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 14
Source File: TestChronoField.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name = "localeDisplayNames") Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 15
Source File: TestChronoField.java From j2objc with Apache License 2.0 | 5 votes |
Object[][] data_localeDisplayNames() { return new Object[][] { {ChronoField.ERA}, {ChronoField.YEAR}, {ChronoField.MONTH_OF_YEAR}, {ChronoField.DAY_OF_WEEK}, // {ChronoField.ALIGNED_WEEK_OF_YEAR}, {ChronoField.DAY_OF_MONTH}, {ChronoField.AMPM_OF_DAY}, {ChronoField.HOUR_OF_DAY}, {ChronoField.MINUTE_OF_HOUR}, {ChronoField.SECOND_OF_MINUTE}, }; }
Example 16
Source File: YearMonthTest.java From j2objc with Apache License 2.0 | 4 votes |
@Test public void test_with_TemporalField_long_invalidField() { ChronoField[] invalidFields = new ChronoField[] { ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR, ChronoField.ALIGNED_WEEK_OF_MONTH, ChronoField.ALIGNED_WEEK_OF_YEAR, ChronoField.AMPM_OF_DAY, ChronoField.CLOCK_HOUR_OF_AMPM, ChronoField.CLOCK_HOUR_OF_DAY, ChronoField.DAY_OF_MONTH, ChronoField.DAY_OF_WEEK, ChronoField.DAY_OF_YEAR, ChronoField.EPOCH_DAY, ChronoField.HOUR_OF_AMPM, ChronoField.HOUR_OF_DAY, ChronoField.INSTANT_SECONDS, ChronoField.MICRO_OF_DAY, ChronoField.MICRO_OF_SECOND, ChronoField.MILLI_OF_DAY, ChronoField.MILLI_OF_SECOND, ChronoField.MINUTE_OF_DAY, ChronoField.MINUTE_OF_HOUR, ChronoField.NANO_OF_DAY, ChronoField.NANO_OF_SECOND, ChronoField.OFFSET_SECONDS, ChronoField.SECOND_OF_DAY, ChronoField.SECOND_OF_MINUTE, }; YearMonth ym = YearMonth.of(2000, Month.JANUARY); for (ChronoField invalidField : invalidFields) { // Get a valid value to ensure we fail to due invalid field, not due to invalid value. long value = invalidField.range().getMinimum(); try { ym.with(invalidField, value); fail("TemporalField.with() should not accept " + invalidField); } catch (UnsupportedTemporalTypeException expected) { } } }