Java LocalTime parseLocalTime(String string)

Here you can find the source of parseLocalTime(String string)

Description

This function attempts to parse a time.

License

Open Source License

Parameter

Parameter Description
string the time

Return

a LocalTIme object

Declaration

private static LocalTime parseLocalTime(String string) 

Method Source Code


//package com.java2s;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;

public class Main {
    private static final DateTimeFormatter POTENTIAL_FORMATS = DateTimeFormatter.ofPattern("[HH:mm:ss][HH:mm]");

    /**/*from ww  w  . j a v  a 2  s  .co  m*/
     * This function attempts to parse a time. Supporting the use of potentially multiple formats from a single place.
     *
     * @param string the time
     * @return a LocalTIme object
     */
    private static LocalTime parseLocalTime(String string) {
        return LocalTime.parse(string, POTENTIAL_FORMATS);
    }
}

Related

  1. deserializeLocalTime(String date)
  2. fastTimeWrite(LocalTime localTime)
  3. getTimeDiff(LocalTime start, LocalTime end)
  4. isBetween(LocalTime lt, LocalTime startTime, LocalTime endTime)
  5. isLocalTimeInRange(LocalTime value, LocalTime optionalMinimum, LocalTime optionalMaximum, boolean inclusiveOfEndpoints)
  6. repDiff(LocalTime start, LocalTime end, byte type)
  7. reportTimeDiff(LocalTime start, LocalTime end)
  8. toLocalTime(Date date)