Java ME MIDLet

L

LinuxRulez

I am developing a Java applicatioin whose date should be a day ahead of
the actual day. Can someone please help me how to add a day to the
current date?

Right now my mid let is able to display the current date....I've tried
using the following code but it seems the add method of the Calendar
class is not supported by the Micro Edition of JAVA

Calendar workingCal;
workingCal = Calendar.getInstance();
workingCal.add(Calendar.DAY_OF_WEEK, 1);

Help!
 
C

Chris Smith

LinuxRulez said:
Right now my mid let is able to display the current date....I've tried
using the following code but it seems the add method of the Calendar
class is not supported by the Micro Edition of JAVA

Calendar workingCal;
workingCal = Calendar.getInstance();
workingCal.add(Calendar.DAY_OF_WEEK, 1);

If you have the date as a Date object, call getTime() to get a long.
Once you've got the date as a long, add 1000 * 60 * 60 * 24. This will
fail if there is a daylight savings time adjustment, but it's the best
that can be done. (The idea behind leaving out Calendar is that MIDP
devices often don't know about daylight savings time.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,078
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top