This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Can't parse dates with full zone name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Can Watch "Can New topic
Author

Can't parse dates with full zone name

Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
I am trying to parse a date with full zone names like 'Canada/Newfoundland' as shown below-
But it leads to exception-
Any ideas?


My Blog
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Well I just gone through the Docs of SimpleDateFormat class.

Format Pattern
--------------
"yyyy.MM.dd G 'at' hh:mm:ss z" ->> 1996.07.10 AD at 15:08:56 PDT
"EEE, MMM d, ''yy" ->> Wed, July 10, '96
"h:mm a" ->> 12:08 PM
"hh 'o''clock' a, zzzz" ->> 12 o'clock PM, Pacific Daylight Time
"K:mm a, z" ->> 0:00 PM, PST
"yyyyy.MMMMM.dd GGG hh:mm aaa" ->> 1996.July.10 AD 12:08 PM

I was not able to find the format you are giving it. I think it should be modified.

HTH


My Blog SCJP 5 SCWCD 5
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37907
    
  22
Go through the TimeZone and DateFormat classes and you can get a TimeZone object from Canada/Newfoundland, then pass it to your DateFormat object. That might sort out your problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't parse dates with full zone name
 
Similar Threads
Calendar() / Date() bug ???
date format conversion to MM/dd/yyyy hh:mm a
Time zone problem in date format
SimpleDateFormat year problem
current time problem on AIX