Java LocalDateTime Format format(LocalDateTime localDateTime, String pattern)

Here you can find the source of format(LocalDateTime localDateTime, String pattern)

Description

format

License

Open Source License

Declaration

public static String format(LocalDateTime localDateTime, String pattern) 

Method Source Code

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

import java.time.LocalDateTime;

import java.time.format.DateTimeFormatter;

public class Main {
    public static final String DEFAULT_PATTERN = "yyyy-MM-dd HH:mm:ss";

    public static String format(LocalDateTime localDateTime, String pattern) {
        if (localDateTime == null) {
            return "";
        }/*from  w  ww .j  av  a  2s .c  o m*/
        return DateTimeFormatter.ofPattern(pattern == null ? DEFAULT_PATTERN : pattern).format(localDateTime);
    }
}

Related

  1. convertDateStringToLocalDateTime(String formattedValue, int hour, int minute)
  2. convertTemporalToSplunkSearchFormat(OffsetDateTime localDateTime)
  3. format(LocalDateTime dateTime)
  4. formatDate(LocalDateTime dateTime)
  5. formatDate(String inPattern, LocalDateTime inTime)
  6. formatDateFromTo(LocalDateTime dateFrom, LocalDateTime dateTo)
  7. formatDateGeneric(DateTimeFormatter dateTimeFormatter, LocalDateTime localDateTime)