Solved

Date problem... I am looking for today's date

Posted on 2006-11-23
4
232 Views
Last Modified: 2010-03-31
Hi Experts


I don't know how to parse an int into a date format

I have to format 20061123 into a Date so that the next while statement will work :


try{
            cal.setTime(format.parse("" + "01-Jan-80"));      
            Date endDate = ?????
            
      
            int j=0;
            
            while(cal.getTime().before(endDate)) {
                  if (j==0){
                        test[j] = "All";
                        j++;
                  }else{
                        String text = format.format(cal.getTime());
                      test[j]= text;
                      cal.add(Calendar.DATE, 1);
                      j++;
                        }
                  }
            }catch(ParseException exp){
          }
0
Comment
Question by:blarouche
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 125 total points
ID: 18005141
Date endDate = new SimpleDataFormat("yyyyMMdd").parse(Integer.toString(20061123));
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18005144
SimpleDataFormat=SimpleDateFormat
0
 

Author Comment

by:blarouche
ID: 18005207
You're fantastic !!!


thank you
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18005217
:-)

Integer.valueOf would be better still
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

691 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