Java ZonedDateTime Format formatDate(ZonedDateTime dt)

Here you can find the source of formatDate(ZonedDateTime dt)

Description

format Date

License

Open Source License

Declaration

public static String formatDate(ZonedDateTime dt) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;

public class Main {
    public static String formatDate(ZonedDateTime dt) {

        DateTimeFormatter fmt = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneOffset.UTC);
        return fmt.format(dt.truncatedTo(ChronoUnit.SECONDS));

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

Related

  1. format(ZonedDateTime zdt, DateTimeFormatter dtf)
  2. format(ZonedDateTime zonedDateTime)
  3. formatDate(ZonedDateTime dateTime)
  4. formatDate_ddMMYYYYHHmmss(ZonedDateTime now)
  5. formatDateAsShortDateLocalTime(ZonedDateTime moonDate, ZoneId tz)
  6. formatDateForGMT(ZonedDateTime moonDate)
  7. formatDateTime(ZonedDateTime zonedDateTime)