Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 17
Registered: ‎02-24-2010
My Device: 9700
My Carrier: AT&T
Accepted Solution

Getting the sytem date and time from the BB device

I have tried the following code which can't work on a BB:

 

//funcon DisplayTime(){

//ar s ti info = System.Tie.get.localime(System.Time.curentTieZone); ....

... this can't work inside the widget because "System" doesn't exists. 

 

I saw there was a very long thread for the Java developers where they finally got it down to 8 or 10 lines of code getting the raw system time in miliseconds then getting the GMT offsed from the calendar then reformatting it to show the correct time....

 

ahem... in the widget environment I don't beleive we have very limited ability to access the system object from blackberry.system, and we can invoke, but not query the  the calendar object (I think)... any suggestions?

 

sure would be nice if there was just a now() function.

 

Regards,

Scott

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: Getting the sytem date and time from the BB device

var now = new Date();

 

That should get the current date and time down to the millisecond with the GMT offset

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Highlighted
Contributor
Posts: 17
Registered: ‎02-24-2010
My Device: 9700
My Carrier: AT&T

Re: Getting the sytem date and time from the BB device

thanks Tim -- you the man!