Java LocalDate to String toString(LocalDate d)

Here you can find the source of toString(LocalDate d)

Description

Return the string of a LocalDate or null if it's null

License

Apache License

Parameter

Parameter Description
d date <p>

Return

String or null

Declaration

public static String toString(LocalDate d) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

public class Main {
    /**//from  ww w  .  j ava  2 s  . com
     * Return the string of a {@link LocalDate} or null if it's null
     * <p>
     * @param d date
     * <p>
     * @return String or null
     */
    public static String toString(LocalDate d) {
        return d == null ? null : d.toString();
    }

    /**
     * Return the string of a {@link LocalTime} or null if it's null
     * <p>
     * @param t time
     * <p>
     * @return String or null
     */
    public static String toString(LocalTime t) {
        return t == null ? null : t.toString();
    }

    /**
     * Return the string of a {@link LocalDateTime} or null if it's null
     * <p>
     * @param dt date time
     * <p>
     * @return String or null
     */
    public static String toString(LocalDateTime dt) {
        return dt == null ? null : dt.toString();
    }
}

Related

  1. dateToFullString(LocalDate date)
  2. dateToString(LocalDate date)
  3. localDate2Str(LocalDate localDate)
  4. localDateToString(LocalDate date)
  5. toDateString(LocalDate date, String pattern)
  6. toString(LocalDate date)