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
Developer
Posts: 235
Registered: ‎11-12-2008
My Device: Not Specified

Calender Calculation

How to calculate the next day from the current day using the Calender

Thanks in advance

 

 

Developer
Posts: 468
Registered: ‎08-07-2009
My Device: Curve, Bold, Storm
My Carrier: Blackberry Developer

Re: Calender Calculation

HI, Can you be more clear. With an e.g. Thanks Ekansh
----------------------------------------------------------
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 235
Registered: ‎11-12-2008
My Device: Not Specified

Re: Calender Calculation

Say for eg...i have current time.

 

Thursday Aug ,5 ,12:00 PM

 

Next would be ...

Friday Aug ,6, 12:00 PM

Then skip the weekend ....then it would b

Mon Aug 9,12:00 PM

Tues Aug 10,12:00 PM

etc....

 

Like this.....

 

 

can u suggest me with the Calender code....

 

 

 

 

 

Developer
Posts: 468
Registered: ‎08-07-2009
My Device: Curve, Bold, Storm
My Carrier: Blackberry Developer

Re: Calender Calculation

                   SimpleDateFormat  timeFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");
                   
                    timeString = ""+ timeFormat.formatLocal(System.currentTimeMillis());

 

Above will give you the current the current date and time

 

 

You can use the following scale

1 sec = 1000 miliseconds

 

so for 1 day i.e 24 hours = (60*60*24)*1000 mili sec

 

add this to current timeMillies

you will get the next day time

 

e.g. timeString = ""+ timeFormat.formatLocal((System.currentTimeMillis()+((60*60*24)*1000)));

 

----------------------------------------------------------
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 235
Registered: ‎11-12-2008
My Device: Not Specified

Re: Calender Calculation

[ Edited ]

Hi

can i have your email address please......

 

or skype id....

 

 

Removed personal information to comply with Community Guidelines and Terms and Conditions of Use.

Please use Private Message system if required.

 

 

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Calendar Calculation

Adding to the response from Ekansh, if you review Calendar and DateTimeUtilities JavaDoc, you should find these two have appropriate methods to enable you to do the things that you have described. 

Developer
Posts: 468
Registered: ‎08-07-2009
My Device: Curve, Bold, Storm
My Carrier: Blackberry Developer

Re: Calendar Calculation

you can ask your problems on this forum.

 

Or There is a option of private message in this forum.

 

 

Thanks

Ekansh

----------------------------------------------------------
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.
Developer
Posts: 235
Registered: ‎11-12-2008
My Device: Not Specified

Re: Calender Calculation

Say there is start time 1:00 P.M end time 2:00 P.M

and say Time duration is 2 hour

 

now the output will be output will be:

 

Fri Aug 6, 1:00 P.M -2:00

Sat Aug 7, 1:00 p.M -2:00

 

anotther eg.

say there is start time 5:30 P.M end time 6:30 P.M

and say Time duration is 15 minutes

another output will be:

 

Fri Aug 6,5:30 P.M -5:45 P.M

Fri Aug 6,5:45 P.M -6:00 P.M

Fri Aug 6,6:00 P.M -6:15 P.M

 

 

 

Please anyone reply on this...specific output...

Thanks in advance..

Developer
Posts: 468
Registered: ‎08-07-2009
My Device: Curve, Bold, Storm
My Carrier: Blackberry Developer

Re: Calender Calculation

Hi,

 

This is simple logic...you should implement this on your own.

 

Nobody cant code for you.

 

Thanks

Ekansh

----------------------------------------------------------
feel free to press the kudos button on the left side to thank the user that helped you.
please mark posts as solved if you found a solution.