Forums Register Login

TimeZones

+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 


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.
+Pie Number of slices to send: Send
it is TimeZone.getAvailableIDs() method

i am getting timeZone as Asia/Colombo.
+Pie Number of slices to send: Send
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 ]
We don't have time for this. We've gotta save the moon! Or check this out:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1619 times.
Similar Threads
Converting XMLGregorianCalendar to Calendar with timeZone information
TimeStamp.toString() does not work as expected
timezone conversion using DST
calendar.getInstance()
DB2 - Changing TimeZone
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:56:56.