Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't parse dates with full zone name

 
Vinod K Singh
Ranch Hand
Posts: 198
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to parse a date with full zone names like 'Canada/Newfoundland' as shown below-
But it leads to exception-
Any ideas?
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Campbell Ritchie
Sheriff
Pie
Posts: 47244
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic