Java LocalDateTime Format formatTime(LocalDateTime time)

Here you can find the source of formatTime(LocalDateTime time)

Description

format Time

License

Open Source License

Declaration

public static String formatTime(LocalDateTime time) 

Method Source Code


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

import java.time.LocalDateTime;

public class Main {
    private static final String timeDelimiter = ":";

    public static String formatTime(LocalDateTime time) {
        return String.join(timeDelimiter, String.format("%02d", time.getHour()),
                String.format("%02d", time.getMinute()), String.format("%02d", time.getSecond()));
    }//from w ww .ja v  a2  s .co m
}

Related

  1. formatDayOfMonth(LocalDateTime dateTime)
  2. formatLocalDateTimeToString(LocalDateTime date)
  3. formatShortDate(LocalDateTime dateTime)
  4. formattedWeek(LocalDateTime localDateTime)
  5. formatTime(LocalDateTime dateTime)
  6. localDateTime2Str(LocalDateTime localDateTime, String dateTimeFormatter)
  7. toDoubleExcelFormat(LocalDateTime date, boolean date1904)
  8. toLocalDateTime(String date, DateTimeFormatter formatter)
  9. toString(LocalDateTime ldt, DateTimeFormatter formatter)