Connecting Tech Pros Worldwide Forums | Help | Site Map

DateFormat.parse issues

Jeremy
Guest
 
Posts: n/a
#1: May 24 '07
I can't get dates to parse with any accuracy. I have a date like this,
for example:

Fri May 25 07:58:46 GMT 2007

I am using a SimpleDateFormat with a format string of:

EEE MMM dd HH:MM:SS z yyyy

When I parse the date and print it back out, it thinks it was:

Tue Oct 25 02:00:00 CDT 2011

Which is not even remotely the same except for the "25".

Any tips on using the date parser? I guess I could just extract all the
fields into integers and make a date out of that, but it seems like
there is built-in functionality for this and I want it to work!

Thanks,
Jeremy

Real Gagnon
Guest
 
Posts: n/a
#2: May 25 '07

re: DateFormat.parse issues


Jeremy <jeremy@pinacol.comwrote in news:6%n5i.11406$qJ1.8078
@newsfe18.lga:
Quote:
I can't get dates to parse with any accuracy. I have a date like this,
for example:
>
Fri May 25 07:58:46 GMT 2007
>
I am using a SimpleDateFormat with a format string of:
>
EEE MMM dd HH:MM:SS z yyyy
>
When I parse the date and print it back out, it thinks it was:
>
Tue Oct 25 02:00:00 CDT 2011
>
Your format string is wrong , try :

EEE MMM dd HH:mm:ss z yyyy

Bye.
--
Real Gagnon from Quebec, Canada
* Java, Javascript, VBScript and PowerBuilder code snippets
* http://www.rgagnon.com/howto.html
* http://www.rgagnon.com/bigindex.html
Jeremy
Guest
 
Posts: n/a
#3: May 25 '07

re: DateFormat.parse issues


Real Gagnon wrote:
Quote:
>
Your format string is wrong , try :
>
EEE MMM dd HH:mm:ss z yyyy
>
Bye.
Yep, you're right. Thanks for spotting that.

Jeremy
Closed Thread