Here you can find the source of formatTimeLocal(Instant instant)
Parameter | Description |
---|---|
instant | the instant to format |
public static String formatTimeLocal(Instant instant)
//package com.java2s; //License from project: Open Source License import java.time.Instant; import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; public class Main { /**/*from w w w. j a v a2 s . com*/ * Returns the instant formatted as only time using the local timezone. * * @param instant the instant to format * @return the instant's time in the local timezone */ public static String formatTimeLocal(Instant instant) { DateTimeFormatter formatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT) .withZone(ZoneId.systemDefault()); return formatter.format(instant); } }