Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
spring_suvarna
Posts: 329
Registered: 02-25-2009
Accepted Solution

Dates of next 14 days

Hello,

 

In my App. i need to display next 14 days Dates from current day.

How can i get next 14 dates?

i am able to get current date.

 

Thanks in advance.

Please use plain text.
Developer
ydaraishy
Posts: 562
Registered: 09-30-2009

Re: Dates of next 14 days

You can convert the current date time to milliseconds and vice versa. Add how many milliseconds there are in a day and convert back to a date, fourteen times.

Please use plain text.
Developer
spring_suvarna
Posts: 329
Registered: 02-25-2009

Re: Dates of next 14 days

Bingo !!

 

i just now tried the same thing and its working fine.

 

1 day = 86400000 millis

 

 

long currentTime = System.currentTimeMillis(); 

currentTime += 86400000; // for 14 times

 

 

Please use plain text.
Developer
peter_strange
Posts: 13,585
Registered: 07-14-2008

Re: Dates of next 14 days

Be aware that this approach may not work around DST change time, because days can be shorter or longer than 24 hours. 

 

I prefer to use the DateTimeUtilities.ONE_DAY type constants when incrementing/decrementing the time.

Please use plain text.
Developer
spring_suvarna
Posts: 329
Registered: 02-25-2009

Re: Dates of next 14 days

Ohh

 

I should take care of it. I will work around and will be back if any queries or solutions.

 

Thanks peter_strange

Please use plain text.