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

Posts: 1
Registered: ‎01-19-2010
My Device: bold
My Carrier: esia

Calendar operation on daylight saving time

Hi all,


Searching on board but still confusing me.


I have calendar application that contain many date operation, adding date, subtracting, comparing date etc.

Everything is OK since the device timezone is not daylight saving time, the problem seen if device timezone is a Daylight Saving time. 

Is there any special treatment for DST timezone, especially for date operation as above ?

Example code for counting day in date range:


public static int getTotalDay(Calendar cal1, Calendar cal2){
		long day_count = (cal2.getTime().getTime() - cal1.getTime().getTime())/ (long)(DateTimeUtilities.ONEDAY);
		return (int) day_count ;