i want java code which find a day of a given date...eg......13 feb 1984(given date).........answer is monday...

Recommended Answers

All 3 Replies

Use java.util.Calendar class.

Hope this helps:
package testFiles;

import java.util.*;
import java.text.SimpleDateFormat;
import java.text.DateFormat;


public class DayName {

    public static void main(String[] args) {

      Date date1 =
        (new GregorianCalendar
          (1984, Calendar.FEBRUARY, 13)).getTime();
      DateFormat f = new SimpleDateFormat("EEEE");

      try {
          System.out.println
          ("1984-3-13 was a " + f.format(date1));

      }
      catch(Exception e) {
        e.printStackTrace();



    }


    }
}

Sorry, but how does doing someone (home)work for them help?

Sure, they can blindly turn in this assignment, but what about tomorrow? When the lesson they are going to be taught is meant to build on what they learned today. Well, they didn't learn anything today, so tomorrow is twice as hard.

P.S. Not that I even bothered to look at the code though, so don't think I'm approving the way you did it, either.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.