"정상적인"시간 또는 시간에 구문 분석 할 수있는 DateTime 파서를 갖고 싶습니다. 나는 00:00:00
또는 24:00:00
을 동시에 가질 수 있음을 의미합니다. 시계 시간은 자정에만 허용됩니다. 의미는 24:00:01
이 아닙니다. 이 값은 00:00:01
이어야합니다. 어떻게 든이 문제를 해결할 수 있습니까? 내 파서는 현재 clockhours을 존중하지 않습니다 누군가가 나를 도울 수 있다면Joda 시간, 시간과 시간을 동시에 구문 분석합니다.
//The formatter for the timezone
DateTimeFormatter timezoneFormatter = new DateTimeFormatterBuilder().appendTimeZoneOffset(null, true, 2, 2)
.toFormatter();
//The formatter for the fractional (3 digit) seconds
DateTimeFormatter fractionalSecondsFormatter = new DateTimeFormatterBuilder().appendLiteral('.')
.appendFractionOfSecond(3, 3).toFormatter();
// Here a parser is created that parses a string of the form HH:mm:ss. Further the string may have
// 3 digit fractional seconds (with a dot as prefix) and may have a timezone.
DATE_TIME_PARSER = new DateTimeFormatterBuilder().appendHourOfDay(2).appendMinuteOfHour(2).appendSecondOfMinute(2)
.appendOptional(fractionalSecondsFormatter.getParser()).appendOptional(timezoneFormatter.getParser())
.toFormatter();
이 greate 것입니다.
안부, 플로리안
ISO 8601 (및 xs : 시간) 시간은 다음과 같이 설명됩니다. hh 형식의 두 자리 숫자는 0에서 24까지의 값을 가질 수 있습니다. 시간 요소 값이 24이면 분 요소와 초 요소는 00과 00이어야합니다. 24는 23과 같을 수 없습니다. 그러면 시간은 21:00, 22:00, 24:00, 00:00이됩니다. Joda와 ISO8601 시간 형식을 매핑하고 싶습니다. (조다에서는 hh가 00-23이고 kk는 01-24이지만 kk는 24:01이 허용되고 ISO8601은 허용되지 않습니다) –
24:00은 동일하므로 이해합니다. 시간은 00:00이지만 24:00 전의 00:00입니다. 24:00은 (ISO8601) 정확히 자정을 기술하는 데에만 사용할 수 있습니다. –