File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes TimeZones Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "TimeZones" Watch "TimeZones" New topic
Author

TimeZones

manoj samarasinghe
Greenhorn

Joined: Nov 17, 2004
Posts: 16
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.


manojmanoj
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
manoj samarasinghe
Greenhorn

Joined: Nov 17, 2004
Posts: 16
it is TimeZone.getAvailableIDs() method

i am getting timeZone as Asia/Colombo.
Dmitry Melnik
Ranch Hand

Joined: Dec 18, 2003
Posts: 328
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TimeZones