Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

Java ME MIDLet

Thread view: 
LinuxRulez - 12 Sep 2006 04:58 GMT
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!
Chris Smith - 12 Sep 2006 05:51 GMT
> 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
[quoted text clipped - 3 lines]
>         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.)

Signature

Chris Smith



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.