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: 45
Registered: ‎01-05-2009
My Device: Not Specified

problem with recursive all day event with negative timezone

Hi Mark,


Could you please confirm if this is a bug too.


set device Time Zone to Eastern US (-5)...only an example


create a new All Day appt dated for Today and then set it to recur Weekly as bellow :




start = today date ; 


   Calendar calStart = Calendar.getInstance();

            calStart.setTime(new Date(start));

            Calendar calEnd = Calendar.getInstance();

            calEnd.setTime(new Date(end));







            calEnd.set(Calendar.DAY_OF_MONTH,calEnd.get(Calendar.DAY_OF_MONTH) + 1);






set the recursive to weekly today day .eg tuesday.




 Problem 1. 

when i open the event in native calendar application  it shows me occurs every week on monday and tuesday.


 Problem 2.

when i retreive the event from event list i get the event for two days. eg if my event is a all day event for today i get the same event for tommorow(wednesday) also.


below is the code for that


  Calendar cal = Calendar.getInstance();

            cal.setTime(new Date(today date));







            long start = cal.getTime().getTime();







            long end = cal.getTime().getTime();   


   Calendar calTemp = Calendar.getInstance();

            calTemp.setTime(new Date(start));


            int diffZonesMeet  = Calendar.getInstance().getTimeZone().getOffset(1,calTemp.get(Calendar.YEAR),calTemp.get(Calendar.MONTH),calTemp.get(Calendar.DAY_OF_MONTH),calTemp.get(Calendar.DAY_OF_WEEK),calTemp.get(Calendar.MILLISECOND));



            long allDayEventStart = start + diffZonesMeet +300000;



            long allDayEventEnd = allDayEventStart + 300000; 


Enumeration e = null;

e = eventList.items(EventList.OCCURRING,allDayEventStart,allDayEventEnd,false); 


and same for tommorow date. 


If device Time Zone is GMT or greater, this doesn't happen. 




BlackBerry Development Advisor
Posts: 15,806
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: problem with recursive all day event with negative timezone

All day events can span multiple days.  From the JavaDocs:


Note that all day events can span multiple days. The start date will be 00:00:00.000 on the day that the event begins. The end date will be 00:00:00.000 on the day after the event ends. This way the difference between the start date and the end date will be the number of days (in milliseconds) of the duration of the event. Also, applications that do not wish to use BlackBerryEvent but instead use only javax.microedition.pim.Event will determine the correct duration of all day events.


You could create your Calendar instance by calling Calendar.getInstance(TimeZone zone) and specify the appropriate time zone. 

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Posts: 22
Registered: ‎08-23-2011
My Device: blackberry torch-9800,bold-9700
My Carrier: airtel

Re: problem with recursive event



I am trying to fetch a recursive event from the below function:


e = eventList.items(BlackBerryEventList.OCCURRING, startTime, endTime, false);


I have a recursive event in the calendar which occurs weekly. And according to my value of startTime and endTime the event is occuring 3 times but when I display them there is only one instance of event available.


So how can I display recursive event with all the dates it is repeating.