get Long ISO Date Time String from LocalDateTime - Java java.time

Java examples for java.time:LocalDateTime

Description

get Long ISO Date Time String from LocalDateTime

Demo Code


//package com.java2s;
import java.time.LocalDate;
import java.time.LocalDateTime;

public class Main {
    public static String getLongISODateTimeString(LocalDateTime in) {
        String temp = in.toString();
        String bad = "2015-01-02T00:00";
        if (temp.length() == bad.length())
            temp += ":00";
        return temp;
    }//w  w w  . j  a  v a  2s  .  c o  m

    public static String getLongISODateTimeString(LocalDate in) {
        String temp = in.toString();
        String bad = "2015-01-02";
        if (temp.length() == bad.length())
            temp += "T00:00:00";
        return temp;
    }
}

Related Tutorials