Here you can find the source of format(Instant _instant, String _format)
Parameter | Description |
---|---|
_instant | a parameter |
public static final String format(Instant _instant, String _format)
//package com.java2s; //License from project: Open Source License import java.time.DateTimeException; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; public class Main { public static final ZoneOffset localZoneOffset = ZoneOffset.UTC; /**/*from w w w . ja va2s .c om*/ * Return a string from Instant using format _format * @param _instant */ public static final String format(Instant _instant, String _format) { DateTimeFormatter format = DateTimeFormatter.ofPattern(_format); try { return LocalDateTime.ofInstant(_instant, localZoneOffset).format(format); } catch (DateTimeException exc) { System.out.printf("%s can't be formatted with pattern!%n", _instant, _format); throw exc; } } }