Java OffsetDateTime format using DateTimeFormatter.ISO_DATE

Description

Java OffsetDateTime format using DateTimeFormatter.ISO_DATE

import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;

public class Main {
  public static void main(String[] args) {
    OffsetDateTime odt = OffsetDateTime.now();
    String odtStr = odt.format(DateTimeFormatter.ISO_DATE);
    System.out.println("Offset Datetime: " + odtStr);

  }/* www . ja v  a  2s  . c om*/
}



PreviousNext

Related