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

STEC-CABSHELF-StarTech.com Black Standard Universal Server Rack Cabinet Shelf
$55.06
STEC-CABSHELF-StarTech.com Black Standard Universal Server Rack Cabinet Shelf pictureLOT OF 8 SAMSUNG ECC REGISTERED 512MB DDR PC2100 D512E266RL RAM MEMORY SERVER
$24.99
LOT OF 8 SAMSUNG ECC REGISTERED 512MB DDR PC2100 D512E266RL RAM MEMORY SERVER pictureGE APEX PRO CH Telemetry Server Computer 9694 - WARRANTY
$200.0
GE APEX PRO CH Telemetry Server Computer 9694 - WARRANTY pictureVollrath 46314 Melody Coffee and Tea Server
$5.0
Vollrath 46314 Melody Coffee and Tea Server pictureBlack reversible Red w white polka dots waitress server waist apron 3 pockets
$11.0
Black reversible Red w white polka dots waitress server waist apron 3 pockets picture






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