BlackBerryForums.com : Your Number One BlackBerry Community
     

»Sponsored Links


BlackBerryApps.com Best Sellers



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
Shreyas Offline
Knows Where the Search Button Is
 
Posts: 16
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Question How to get time format of current TimeZone ? - 10-28-2009, 12:46 PM

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 ?
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
Shreyas Offline
Knows Where the Search Button Is
 
Posts: 16
Join Date: Sep 2009
Model: Strom
PIN: N/A
Carrier: Vodafone
Question 10-29-2009, 10:01 AM

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 10:40 AM.
   
Reply With Quote
Reply


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





Copyright © 2004-2009 BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.