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

Java Development

Reply
Contributor
Posts: 48
Registered: ‎03-04-2009
My Device: Not Specified

Difference between Java.util.Date on Java and Blackberry java.util.date

Hi Friends,

 1. I run following code on Core java.

   long datemilis = 1304290800000l;

System.out.Println(new Date(datemilis ));

Output: Mon May 02 00:00:00 BST 2011

  2. After That i Run Same Code in Blackberry and Output is:

        Output:  Sun May 01 23:00:00 GMT 2011

 

There are one Day Diference how to solve this..

 

Regards

Suresh Kerai

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Difference between Java.util.Date on Java and Blackberry java.util.date

it's only 1h difference. most likely something related to the timezone of the simulator.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 604
Registered: ‎12-27-2010
My Device: Not Specified

Re: Difference between Java.util.Date on Java and Blackberry java.util.date

Simon is correct, BST is GMT +0100 so the difference between the two is that. BB stores dates in GMT, so you can use SimpleDateFormat to easily get it to print out in the timezone of the phone or simulator.