Java Instant isSupported() methodThe isSupported() method of Java Instant class is used to check if the specified field or unit is supported. The isSupported() method consists of 2 parameters. SyntaxParametersfield- The field to check, null returns false. unit- The unit to check, null returns false. ReturnExceptionsTrue, if the unit is supported on this instant, false if not. True, if the unit is supported on this instant, false if not. Java Instant isSupported(TemporalField field) methodExample 1Output: The output will be like this. false Example 2Output: The output will be like this. true Example 3Output: The output will be like this. false Example 4Output: The output will be like this: true Example 5Output: The output will be like this. 2017-05-01T20:57:45.145Z NanoOfSecond > true NanoOfDay > false MicroOfSecond > true MicroOfDay > false MilliOfSecond > true MilliOfDay > false SecondOfMinute > false SecondOfDay > false MinuteOfHour > false MinuteOfDay > false HourOfAmPm > false ClockHourOfAmPm > false HourOfDay > false ClockHourOfDay > false AmPmOfDay > false DayOfWeek > false AlignedDayOfWeekInMonth > false AlignedDayOfWeekInYear > false DayOfMonth > false DayOfYear > false EpochDay > false AlignedWeekOfMonth > false AlignedWeekOfYear > false MonthOfYear > false ProlepticMonth > false YearOfEra > false Year > false Era > false InstantSeconds > true OffsetSeconds > false Java Instant isSupported(TemporalUnit unit) methodExample 6Output: The output will be like this. true Example 7Output: The output will be like this. false Example 8Output: The output will be like this. true Example 9Output: The output will be like this. false Example 10Output: The output will be like this. 2017-05-01T20:57:47.276Z Nanos > true Micros > true Millis > true Seconds > true Minutes > true Hours > true HalfDays > true Days > true Weeks > false Months > false Years > false Decades > false Centuries > false Millennia > false Eras > false Forever > false Next TopicJava-instant-isbefore-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India