Unable to Parse JDK Date.toString

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Unable to Parse JDK Date.toString

Michael Franz

Hi,

I have cannot get Joda-Time to parse the default toString of the JDK's Date class.  It seems that joda-time can create duplicate the formatting, but cannot parse the date.

Here is the simple code.

        Date testDate = new Date();
       
        System.out.println(testDate);
       
        DateTimeFormatter fmt = DateTimeFormat.forPattern("EEE MMM dd HH:mm:ss z yyyy");
        String test = fmt.print(new DateTime(testDate));
        System.out.println(test);
       
        DateTime testOut = fmt.parseDateTime(test);   // <--- this throws IllegalArgumentException
        System.out.println(testOut);

Is there a way to get this to work?

Michael


*******************************************************************************
This e-mail message is intended solely for the use of the addressee.
The message may contain information that is privileged and
confidential.
Disclosure to anyone other than the intended recipient is prohibited.
If you are not the intended recipient, please do not disseminate,
distribute or copy this communication, by e-mail or otherwise. Instead,
please notify us immediately by return e-mail(including the original
message with your reply) and then delete and discard all copies of the
message. We have taken precautions to minimize the risk of transmitting
software viruses but nevertheless advise you to carry out your own
virus checks on any attachment to this message. We accept
no liability for any loss or damage caused by software viruses.
*******************************************************************************

 


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unable to Parse JDK Date.toString

jodastephen
Not at present. Joda-Time does not parse short time zone strings.
Stephen


Michael Franz wrote:

>
> Hi,
>
> I have cannot get Joda-Time to parse the default toString of the JDK's
> Date class.  It seems that joda-time can create duplicate the
> formatting, but cannot parse the date.
>
> Here is the simple code.
>
>         Date testDate = *new* Date();
>        
>         System./out/.println(testDate);
>        
>         DateTimeFormatter fmt = DateTimeFormat./forPattern/("EEE MMM dd
> HH:mm:ss z yyyy");
>         String test = fmt.print(*new* DateTime(testDate));
>         System./out/.println(test);
>        
>         DateTime testOut = fmt.parseDateTime(test);   // <--- this
> throws IllegalArgumentException
>         System./out/.println(testOut);
>
> Is there a way to get this to work?
>
> Michael
>
>
> *******************************************************************************
> This e-mail message is intended solely for the use of the addressee.
> The message may contain information that is privileged and
> confidential.
> Disclosure to anyone other than the intended recipient is prohibited.
> If you are not the intended recipient, please do not disseminate,
> distribute or copy this communication, by e-mail or otherwise. Instead,
> please notify us immediately by return e-mail(including the original
> message with your reply) and then delete and discard all copies of the
> message. We have taken precautions to minimize the risk of transmitting
> software viruses but nevertheless advise you to carry out your own
> virus checks on any attachment to this message. We accept
> no liability for any loss or damage caused by software viruses.
> *******************************************************************************
>
>  
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unable to Parse JDK Date.toString

Michael Franz

Is this on the list todo?  Is there an issue for this?  If I found the correct issue tracker there are only 5 open issues.  Is that correct?



Stephen Colebourne <[hidden email]>
Sent by: [hidden email]

09/09/2008 06:14 PM

Please respond to
Discussion of the Joda project <[hidden email]>

To
Discussion of the Joda project <[hidden email]>
cc
Subject
Re: [Joda-interest] Unable to Parse JDK Date.toString




Not at present. Joda-Time does not parse short time zone strings.
Stephen


Michael Franz wrote:
>
> Hi,
>
> I have cannot get Joda-Time to parse the default toString of the JDK's
> Date class.  It seems that joda-time can create duplicate the
> formatting, but cannot parse the date.
>
> Here is the simple code.
>
>         Date testDate = *new* Date();
>        
>         System./out/.println(testDate);
>        
>         DateTimeFormatter fmt = DateTimeFormat./forPattern/("EEE MMM dd
> HH:mm:ss z yyyy");
>         String test = fmt.print(*new* DateTime(testDate));
>         System./out/.println(test);
>        
>         DateTime testOut = fmt.parseDateTime(test);   // <--- this
> throws IllegalArgumentException
>         System./out/.println(testOut);
>
> Is there a way to get this to work?
>
> Michael
>
>
> *******************************************************************************
> This e-mail message is intended solely for the use of the addressee.
> The message may contain information that is privileged and
> confidential.
> Disclosure to anyone other than the intended recipient is prohibited.
> If you are not the intended recipient, please do not disseminate,
> distribute or copy this communication, by e-mail or otherwise. Instead,
> please notify us immediately by return e-mail(including the original
> message with your reply) and then delete and discard all copies of the
> message. We have taken precautions to minimize the risk of transmitting
> software viruses but nevertheless advise you to carry out your own
> virus checks on any attachment to this message. We accept
> no liability for any loss or damage caused by software viruses.
> *******************************************************************************
>
>  
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Unable to Parse JDK Date.toString

jodastephen
Yes, that is the correct issue tracker. However, it is unlikely to get
fixed as the short time zones are not unique and map to multiple real
time zones. Joda-Time has chosen to steer clear of that issue.

Stephen


Michael Franz wrote:

>
> Is this on the list todo?  Is there an issue for this?  If I found the
> correct issue tracker there are only 5 open issues.  Is that correct?
>
>
>
> *Stephen Colebourne <[hidden email]>*
> Sent by: [hidden email]
>
> 09/09/2008 06:14 PM
> Please respond to
> Discussion of the Joda project <[hidden email]>
>
>
>
> To
> Discussion of the Joda project <[hidden email]>
> cc
>
> Subject
> Re: [Joda-interest] Unable to Parse JDK Date.toString
>
>
>
>
>
>
>
> Not at present. Joda-Time does not parse short time zone strings.
> Stephen
>
>
> Michael Franz wrote:
>  >
>  > Hi,
>  >
>  > I have cannot get Joda-Time to parse the default toString of the JDK's
>  > Date class.  It seems that joda-time can create duplicate the
>  > formatting, but cannot parse the date.
>  >
>  > Here is the simple code.
>  >
>  >         Date testDate = *new* Date();
>  >        
>  >         System./out/.println(testDate);
>  >        
>  >         DateTimeFormatter fmt = DateTimeFormat./forPattern/("EEE MMM dd
>  > HH:mm:ss z yyyy");
>  >         String test = fmt.print(*new* DateTime(testDate));
>  >         System./out/.println(test);
>  >        
>  >         DateTime testOut = fmt.parseDateTime(test);   // <--- this
>  > throws IllegalArgumentException
>  >         System./out/.println(testOut);
>  >
>  > Is there a way to get this to work?
>  >
>  > Michael
>  >
>  >
>  >
> *******************************************************************************
>  > This e-mail message is intended solely for the use of the addressee.
>  > The message may contain information that is privileged and
>  > confidential.
>  > Disclosure to anyone other than the intended recipient is prohibited.
>  > If you are not the intended recipient, please do not disseminate,
>  > distribute or copy this communication, by e-mail or otherwise. Instead,
>  > please notify us immediately by return e-mail(including the original
>  > message with your reply) and then delete and discard all copies of the
>  > message. We have taken precautions to minimize the risk of transmitting
>  > software viruses but nevertheless advise you to carry out your own
>  > virus checks on any attachment to this message. We accept
>  > no liability for any loss or damage caused by software viruses.
>  >
> *******************************************************************************
>  >
>  >  
>  >
>  >
>  > ------------------------------------------------------------------------
>  >
>  > -------------------------------------------------------------------------
>  > This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
>  > Build the coolest Linux based applications with Moblin SDK & win
> great prizes
>  > Grand prize is a trip for two to an Open Source event anywhere in the
> world
>  > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>  >
>  >
>  > ------------------------------------------------------------------------
>  >
>  > _______________________________________________
>  > Joda-interest mailing list
>  > [hidden email]
>  > https://lists.sourceforge.net/lists/listinfo/joda-interest
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Joda-interest mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/joda-interest

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Joda-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/joda-interest
Loading...