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  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

New BlackBerry Icon Mouse Pad Mats Mousepad Hot Gift
$10.9
New BlackBerry Icon Mouse Pad Mats Mousepad Hot Gift picture15 PCS BLACKBERRY M-S1 BLACKBERRY BOLD BATTERY (BAT-14392-001) BATTERIES
$3.99
15 PCS BLACKBERRY M-S1 BLACKBERRY BOLD BATTERY (BAT-14392-001) BATTERIES picture12 cans ZEP Meter Mist mandarian + blackberry + vanilla
$43.99
12 cans ZEP Meter Mist mandarian + blackberry + vanilla pictureScreen Protectors ZAGG InvisibleShield Screen Protector for BlackBerry Bold 9000
$23.78
Screen Protectors ZAGG InvisibleShield Screen Protector for BlackBerry Bold 9000 pictureFlower Essences Flower Essence Services Fes Quintessentials Blackberry Dropper,
$13.9
Flower Essences Flower Essence Services Fes Quintessentials Blackberry Dropper, picture






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