• Post Reply Bookmark Topic Watch Topic
  • New Topic

Rich Faces always show GMT as TimeZone  RSS feed

 
Shikha bajpai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Above code is always showing date as "31-Oct-2014 10:28:57 AM GMT". I want to display this in "31-Oct-2014 10:28:57 AM EDT". Please help to know the solution.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

For compatibility with JDK 1.1.x, some other three-letter time zone IDs (such as "PST", "CTT", "AST") are also supported. However, their use is deprecated because the same abbreviation is often used for multiple time zones (for example, "CST" could be U.S. "Central Standard Time" and "China Standard Time"), and the Java platform can then only recognize one of them.


Incidentally, when they say "other three-letter time zone IDs" they mean that the 3-letter IDs "UTC" and "GMT" are always valid, not deprecated.

The preferred zone ID for Eastern time (which just exited Daylight Savings in the USA) would be something like "America/New_York". You can get a complete enumeration of the valid values from the API - the documentation is in there somewhere, although I don't remember exactly where.

The important thing is that JSF didn't re-invent time zones, so it's using the same options as http://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html

Where your main point of failure was was in specifying EDT - Eastern Daylight Time. EST might have worked. But one of the other reasons why the 3-letter codes are deprecated is that "EST" would presumably actually return an EDT value when USA Daylight Savings was in effect, which is confusing. And different countries within a timezone go on/off Daylight/Summer time on different dates. Which is why the Continent/City notation is preferable. It allows picking the most appropriate locale for both zone and daylight shift.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!