This weird date format with the optional space is a standard date ouput
format of the C programming language. It's also a valid date format in
the HTTP spec (RFC 2616). I remember running into this awhile back (may
even have posted on this mailinglist back then), but very shortly after
that, the requirements changed and I abandoned that track; in other
words, I never did get around to solving the problem.
Still, there are two good reasons to support this dateformat in
Joda-Time (C and the HTTP spec), so if the DateTimeFormatter can't deal
with it, it might be worthwhile to extend its functionality in the next
release.
Until then, Bart, you may have to massage the input string a bit before
feeding it to a DateTimeFormatter (replacing the fifth character by a 0
if it's a space would work). Not an attractive solution, but it'd get
the job done.
Regards,
Barend
-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens bart zagers
Verzonden: woensdag 14 februari 2007 9:20
Aan: [email protected]
Onderwerp: [Joda-interest] DateTimeFormatter compared to
SimpleDateFormat
I found a difference between the behaviour of the
SimpleDateFormat and DateTimeFormatter.
I wanted to parse date strings of the following format:
Feb 12 2007 (1 space between Feb and 12)
Feb 9 2007 (2 spaces between Feb and 9)
If I use the string "MMM d yyyy" (1 space between M and d), both
date strings parse fine using the SimpleDateFormat, but the second one
fails using DateTimeFormatter.
Is this the expected behaviour?
Is there a single pattern that can be used to parse both date
strings (I receive them and can not change the format)?
Disclaimer:
This message contains information that may be privileged or confidential and is
the property of Sogeti Nederland B.V. or its Group members. It is intended only
for the person to whom it is addressed. If you are not the intended recipient,
you are not authorized to read, print, retain, copy, disseminate, distribute,
or use this message or any part thereof. If you receive this message in error,
please notify the sender immediately and delete all copies of this message.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest