fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.text.*;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. String date = "05/08/2015";
  14. String dayWeek = "";
  15. try {
  16. gc.setTime(new SimpleDateFormat("dd/MM/yyyy").parse(date));
  17. switch (gc.get(Calendar.DAY_OF_WEEK)) {
  18. case Calendar.SUNDAY:
  19. dayWeek = "DOM";
  20. break;
  21. case Calendar.MONDAY:
  22. dayWeek = "SEG";
  23. break;
  24. case Calendar.TUESDAY:
  25. dayWeek = "TER";
  26. break;
  27. case Calendar.WEDNESDAY:
  28. dayWeek = "QUA";
  29. break;
  30. case Calendar.THURSDAY:
  31. dayWeek = "QUI";
  32. break;
  33. case Calendar.FRIDAY:
  34. dayWeek = "SEX";
  35. break;
  36. case Calendar.SATURDAY:
  37. dayWeek = "SAB";
  38.  
  39. }
  40. } catch (ParseException e) {
  41. e.printStackTrace();
  42. }
  43. System.out.println(dayWeek);
  44. }
  45. }
Success #stdin #stdout 0.14s 56992KB
stdin
Standard input is empty
stdout
QUA