format LocalDateTime as HH:mm:ss - Java java.time

Java examples for java.time:LocalDateTime

Description

format LocalDateTime as HH:mm:ss

Demo Code


//package com.java2s;

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

public class Main {
    public static String formatTime(LocalDateTime date) {
        return date.format(DateTimeFormatter.ofPattern("HH:mm:ss"));
    }/*  w w  w . ja  v a2  s .  co  m*/
}

Related Tutorials