format LocalDateTime as dd/MM/yyyy HH:mm:ss - Java java.time

Java examples for java.time:LocalDateTime

Description

format LocalDateTime as dd/MM/yyyy HH:mm:ss

Demo Code


//package com.java2s;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Main {
    public static String formatDateAndTime(LocalDateTime date) {
        return date.format(DateTimeFormatter
                .ofPattern("dd/MM/yyyy HH:mm:ss"));
    }//from www. j  a  v a 2s .c  om
}

Related Tutorials