Here you can find the source of format(DateTimeFormatter formatter, Object object)
Formats a TemporalAccessor object into a String using the specified DateTimeFormatter .
Parameter | Description |
---|---|
formatter | DateTimeFormatter to be used to format the date object |
object | Instant to format |
public static String format(DateTimeFormatter formatter, Object object)
//package com.java2s; //License from project: Open Source License import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAccessor; public class Main { /**//from www.j a v a 2 s.c om * <p> * Formats a {@link TemporalAccessor} object into a {@code String} using the * specified {@link DateTimeFormatter}. * </p> * * <p> * This method was implemented for allowing * {@link org.dei.perla.core.message.Mapper}s to format an unknown object * of PerLa type TIMESTAMP. * </p> * * @param formatter * {@link DateTimeFormatter} to be used to format the date object * @param object * {@link Instant} to format * @return String representation of the {@link Instant} */ public static String format(DateTimeFormatter formatter, Object object) { return format(formatter, (TemporalAccessor) object); } /** * Formats a {@link TemporalAccessor} object into a {@code String} using the * specified {@link DateTimeFormatter}. * * @param formatter * {@link DateTimeFormatter} to be used to format the date object * @param instant * {@link Instant} to format * @return String representation of the {@link Instant} */ public static String format(DateTimeFormatter formatter, TemporalAccessor instant) { return formatter.format(instant); } }