0

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

4
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by masijade
0

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();



    }


    }
}

Edited by Reverend Jim: Fixed formatting

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.