Solved

How to get the next day in Java?

Posted on 2010-08-27
2
719 Views
Last Modified: 2013-12-14
Hi I'm working with dates in Java in format of ddmmyyyy and mmddyyyy. Currently I'm working with strings only and I wany to use Java objects instead. I need these features from the object:

1. I need the ability to get a string represantaion of the Object as dd/mm/yyyy or mm/dd/yyyy.
2. I need to be able to get the next day in  the calendar (the input should be such a Java object)
3. Is this object Comparable? i.e Can I insert it to a tree map and it will be sorted accordingly?

What object should I use and how?

Thanks!
0
Comment
Question by:HPBSM
2 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 33543093
1. Use a DateFormat
2. Use Calendar.add
3. Yes, Date is Comparable - you'd use that. It's the *keys* of a tree map that are sorted
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 33546122
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Java 1603 Error 2 42
count11 challenge 6 47
Free Alternative to JIRA 4 58
JUnit 4 @Before and @BeforeClass differences 3 22
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
This video teaches viewers about errors in exception handling.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now