Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

DateFormat.parse issues

Thread view: 
Jeremy - 24 May 2007 23:05 GMT
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 - 25 May 2007 01:41 GMT
Jeremy <jeremy@pinacol.com> wrote in news:6%n5i.11406$qJ1.8078
@newsfe18.lga:

> I can't get dates to parse with any accuracy.  I have a date like this,
> for example:
[quoted text clipped - 8 lines]
>
> Tue Oct 25 02:00:00 CDT 2011

Your format string is wrong , try :

EEE MMM dd HH:mm:ss z yyyy

Bye.
Signature

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 - 25 May 2007 18:10 GMT
> Your format string is wrong , try :
>
> EEE MMM dd HH:mm:ss z yyyy
>
> Bye.

Yep, you're right.  Thanks for spotting that.

Jeremy


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.