Java ZonedDateTime Format formatZonedDateTime(ZonedDateTime zonedDateTime)

Here you can find the source of formatZonedDateTime(ZonedDateTime zonedDateTime)

Description

format Zoned Date Time

License

Creative Commons License

Declaration

public static String formatZonedDateTime(ZonedDateTime zonedDateTime) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

import java.util.Locale;

public class Main {
    public static String formatZonedDateTime(ZonedDateTime zonedDateTime) {
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm zZ",
                Locale.getDefault());
        return zonedDateTime.format(dateTimeFormatter.withZone(getZoneId()));
    }// ww  w. jav  a2 s  .co m

    private static ZoneId getZoneId() {
        return ZoneId.systemDefault();
    }
}

Related

  1. formatDate(ZonedDateTime dt)
  2. formatDate_ddMMYYYYHHmmss(ZonedDateTime now)
  3. formatDateAsShortDateLocalTime(ZonedDateTime moonDate, ZoneId tz)
  4. formatDateForGMT(ZonedDateTime moonDate)
  5. formatDateTime(ZonedDateTime zonedDateTime)
  6. getFormattedHour(ZonedDateTime dateTime)
  7. parseZonedDateTime(String s, DateTimeFormatter dtf)
  8. toStringExcelFormat(ZonedDateTime date)
  9. toZonedDateTime(String date, DateTimeFormatter formatter)