Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

TimeZones

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,

calendar.set(year , month , day , hour , minute , second);
TimeZone timeZone = null;

if ((timezone != null) && (!(timezone.toString().equals(""))))
{
timeZone = TimeZone.getTimeZone(timezone);

if (!timezone.equalsIgnoreCase(timeZone.getID()))
{
String msg = MPWAUtils.getLogMessage(
"error.general.invalid_time");
log.error(msg);
throw new InvalidParameterException(
MPWAConstants.ERRMSG_INVALID_TIME , msg);
}

log.debug("time zone " + timeZone);
calendar.setTimeZone(timeZone);
log.debug("time zone after set in Calendar " + timeZone);
//Generate TimeStamp from Calendar
timeStamp = new Timestamp(calendar.getTime().getTime());




i use above code to check any entered time zone is valid.

i need to check its validity and throw an exception if it is wrong timeZone.

but i dont want the time zone to be converted to default one.

and i need to get all available time zones in the world.

currently TimeZOne.getAvailableZones() will not get all of them\

help me

thanks maoj.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


currently TimeZOne.getAvailableZones() will not get all of them\


Where are you getting your TimeZone object? There is no class in the JDK called TimeZone with a getAvailableZones() method.
 
manoj samarasinghe
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is TimeZone.getAvailableIDs() method

i am getting timeZone as Asia/Colombo.
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
currently TimeZOne.getAvailableZones() will not get all of them

What makes you think so?

i am getting timeZone as Asia/Colombo

...and what's wrong with that?
[ February 22, 2005: Message edited by: Dmitry Melnik ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic