Java Week Day getAPastDayOfTheWeek(String dayToGet)

Here you can find the source of getAPastDayOfTheWeek(String dayToGet)

Description

get A Past Day Of The Week

License

Open Source License

Declaration

public static Date getAPastDayOfTheWeek(String dayToGet) 

Method Source Code

//package com.java2s;
/*//from  w ww  .  j  a  v  a 2s.  c  o m
 * Expander: Text Expansion Application
 * Copyright (C) 2016 Brett Huber
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static Date getAPastDayOfTheWeek(String dayToGet) {

        Calendar calendar = new GregorianCalendar();

        switch (dayToGet) {
        case "Monday":
            calendar.set(2015, Calendar.JUNE, 15);
            break;
        case "Tuesday":
            calendar.set(2015, Calendar.JUNE, 16);
            break;
        case "Wednesday":
            calendar.set(2015, Calendar.JUNE, 17);
            break;
        case "Thursday":
            calendar.set(2015, Calendar.JUNE, 18);
            break;
        case "Friday":
            calendar.set(2015, Calendar.JUNE, 19);
            break;
        case "Saturday":
            calendar.set(2015, Calendar.JUNE, 20);
            break;
        case "Sunday":
            calendar.set(2015, Calendar.JUNE, 21);
            break;
        }

        calendar.set(Calendar.HOUR_OF_DAY, 17);
        calendar.set(Calendar.MINUTE, 35);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);

        return calendar.getTime();
    }
}

Related

  1. dayOfWeek(final Date date)
  2. dayOfWeek(String pFormerStr)
  3. dayOfWeekFix(Calendar calendar)
  4. dayOfWeekRus(Date d)
  5. firstDayOfWeek(int year, int month)
  6. getBothDayOfWeek(String str, int week)
  7. getCurrentDayOfWeekArabia()
  8. getCurrentDayOfWeekEnglish()
  9. getCurWeek(String day)