BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-28-2009, 11:46 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Posts: 28
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question How to get time format of current TimeZone ?

Please Login to Remove!

I m getting current time zone as ,

Code:
String defaultTimeZone = ""+TimeZone.getDefault();
Now I want to get its time for which I m using ,

Code:
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
for eg, if currentTimeZone = "Calcutta" then its time is +0530 which will be like ,

Code:
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss +0530");
I m using Java1.4 & RIM APIs , in Java 1.5 u can write as "yyyy-MM-dd HH:mm:ss Z" to get "+0530"

So how to do it ?
Offline  
Old 10-29-2009, 09:01 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Posts: 28
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question

Hey. I got it working with

Code:
Calendar cal = Calendar.getInstance();
TimeZone timeZone = TimeZone.getDefault();
int rawOffset = timeZone.getRawOffset();
But getRawOffset() doesnt consider DayLight Savings Time (DST) & getOffset() does it.
if i use getOffset then the result is coming 1 hr forward/backward for TimeZones which uses DST. (means in short for TimeZones using DST, Blackberry device is not using DST when I use getOffset(..))

(for eg. for "Adelaide" its time in Blackberry device is GMT +09:30 & if I use getOffset() then its coming +10:30)

So i think the Day Light Savings in disabled in my Blackberry Device. do anyone know how to enable it ? any settings to be done ? How to solve this issue for DST ?

Last edited by Shreyas : 10-29-2009 at 09:40 AM.
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.