BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 06-30-2007, 02:51 PM   #1 (permalink)
New Member
 
Join Date: Jun 2007
Model: 7290
PIN: N/A
Carrier: GPRS
Posts: 8
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question How can I set the System time using java code?

Please Login to Remove!

Hello,

I need to set the time of my Blackberry device from my java code.

It's possible to do that?

Thanks a lot!

Sugoi
Offline  
Old 07-02-2007, 02:10 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2007
Location: Ernakulam, Kerala, India
Model: 8320
Carrier: Airtel
Posts: 65
Post Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Use java.util.Date class

Hi sugoi

You can change the time or you can set it using the java.util.Date class's function setTime(long time).

Use Like this
Code:
  java.util.Date BBDate = new java.util.Date();// this will point BBDate to current time settings.
  long time = 0xabc12def34abL;// long value representing the time, it'll represent a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT.  
  BBDate.setTime(time);
Good Luck
Anand

Last edited by Ananthasivan V K : 07-02-2007 at 02:11 AM. Reason: Accuracy
Offline  
Old 07-02-2007, 02:39 AM   #3 (permalink)
New Member
 
Join Date: Jun 2007
Model: 8800
PIN: N/A
Carrier: Vodafone
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Won't that just change the time of the new Date instance you have created, not change the whole system time permanently?
Offline  
Old 07-02-2007, 08:59 AM   #4 (permalink)
New Member
 
Join Date: Apr 2007
Model: 8100
Carrier: Cingular
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

net.rim.device.api.system.Device
public static boolean setDateTime(long dateTimeMillis)
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





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