Hi! I have never seen this before, but wikipedia says http://en.wikipedia.org/wiki/ISO_8601#Times 2010-05-01 24:00:00 equal to 2010-05-02 00:00:00 And I would also consider that 2010-05-01 25:00:00 equal to 2010-05-02 01:00:00
This looks a bit tricky :). If there was a formatter for it, parsing and then printing might result in different strings. The question is: How does the formatter know when to use 2010-05-01 24:00:00 instead of 2010-05-02 00:00:00 when printing. Just parsing is not that difficult. Replace 240000 with 000000, and then plusDays(1) /Morgan -----Ursprungligt meddelande----- Från: Stephen Magee [mailto:stephen_ma...@amt-sybex.com] Skickat: den 29 april 2010 11:47 Till: rhi...@medimorphosis.com.au; Discussion of the Joda project Ämne: Re: [Joda-interest] Parsing 'end of day' time 240000 Hi Rob, We're processing data coming in from the gas/electricity and they use 000000 to signify the start of the day and 240000 to signify the end of the day. I'd never seen it myself before now but on reading up on it here http://en.wikipedia.org/wiki/24-hour_clock and here http://en.wikipedia.org/wiki/ISO_8601 it does seem to be a valid time. I have tried using 'kk' in the format string but that rules out 000000 and anyway 24 is only supposed to be valid in the above if the minutes and seconds part are zero. Stephen -----Original Message----- From: Rob Hills [mailto:rhi...@medimorphosis.com.au] Sent: 29 April 2010 10:24 To: Discussion of the Joda project Subject: Re: [Joda-interest] Parsing 'end of day' time 240000 Hi Stephen, Stephen Magee wrote: > > I'm trying to parse some data that will include times in HHmmss format > from 000000 to 240000. This seems to be allowed according to ISO8601 > but I get an exception on parsing 240000 where it says that the hour > must be from 1 to 23. > > Is there anyway to configure a DateTimeFormat to accept times in the > range 000000 to 240000? > I'd have thought that 000000 and 240000 represent exactly the same thing so I'm guessing that's why Joda Time won't accept 240000. I'd have thought that midnight is 000000 and the second before that was 235959 or am I missing something? HTH, Rob Hills Waikiki, Western Australia ------------------------------------------------------------------------ ------ _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest P Please consider the environment before printing this email _________________________________________________________ 1. The information contained in this E-mail, including any files transmitted with it, is confidential and may be legally privileged. This E-mail is intended only for the personal attention of the stated addressee(s). Any access to this E-mail, including any files transmitted with it, by any other person is unauthorised. If you are not an addressee, you must not disclose, copy, circulate or in any other way use or rely on the information contained in this E-mail or any files transmitted with it. Such unauthorised use may be unlawful. If you have received this E-mail in error, please inform the sender immediately and delete it and all copies from your system. If you are an addressee you may not forward this E-mail without the permission of the sender as it is sent on a Commercial in Confidence basis. 2. The views expressed in this E-mail are those of the author, and do not necessarily represent the views of AMT-SYBEX. Internet communications are not secure and AMT-SYBEX cannot, therefore, accept legal responsibility for the contents of this message nor for any damage caused by viruses. AMT-SYBEX Limited is a UK company, registration number GB03036807 at address The Spirella Building, Bridge Road, Letchworth, SG6 4ET. For more information on the AMT-SYBEX Group visit http://www.amt-sybex.com _________________________________________________________ ------------------------------------------------------------------------------ _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest ------------------------------------------------------------------------------ _______________________________________________ Joda-interest mailing list Joda-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/joda-interest