The DateMidnight class isn't the best in Joda-Time. This isn't a bug
because it fullfills the dateTimeParser() spec:

     * Returns a generic ISO datetime parser which parses either a date or
     * a time or both. It accepts formats described by the following syntax:
     * <pre>
     * datetime          = time | date-opt-time
     * time              = 'T' time-element [offset]
     * date-opt-time     = date-element ['T' [time-element] [offset]]
     * date-element      = std-date-element | ord-date-element |
week-date-element
     * std-date-element  = yyyy ['-' MM ['-' dd]]
     * ord-date-element  = yyyy ['-' DDD]
     * week-date-element = xxxx '-W' ww ['-' e]
     * time-element      = HH [minute-element] | [fraction]
     * minute-element    = ':' mm [second-element] | [fraction]
     * second-element    = ':' ss [fraction]
     * fraction          = ('.' | ',') digit+
     * offset            = 'Z' | (('+' | '-') HH [':' mm [':' ss [('.'
| ',') SSS]]])
     * </pre>

ie. the offset is only allowed when a time is present.

The ThreeTen/JSR-310 OffsetDate class handles this better.

Stephen


On 3 January 2011 22:28, Timothy Barthel <tim...@vsp.com> wrote:
> Hello all,
>
> I am using the joda library with XML based web services. Here is my code:
>         String instant = "2010-12-28-08:00";
>         DateMidnight d = new DateMidnight(instant);
>         System.out.println("Parsed midnight:" + d);
>
> This throws: Exception in thread "main" java.lang.IllegalArgumentException:
> Invalid format: "2010-12-28-08:00" is malformed at "-08:00" The docs seem to
> indicate that the timezone offset can appear in the string. Is this a bug?
> Thanks.
>
> Tim
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Timothy C. Barthel  tim...@vsp.com
> Vision Service Plan -- External Portals Team
> 3333 Quality Drive, Rancho Cordova, CA 95670
>
> MailGate.vsp.com made the following annotations
> ---------------------------------------------------------------------
> NOTICE: This message is intended only for the individual to whom it is
> addressed and may contain information that is confidential or privileged. If
> you are not the intended recipient, or the employee or person responsible
> for delivering it to the intended recipient, you are hereby notified that
> any dissemination, distribution, copying or use is strictly prohibited. If
> you have received this communication in error, please notify the sender and
> destroy or delete this communication immediately.
> ---------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment,
> and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Joda-interest mailing list
> Joda-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to