Java Day of Week getWeekID(Date dateValue)

Here you can find the source of getWeekID(Date dateValue)

Description

get Week ID

License

Open Source License

Declaration

public static String getWeekID(Date dateValue) 

Method Source Code


//package com.java2s;

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

public class Main {

    public static String getWeekID(Date dateValue) {
        String strWeekID = "";
        Calendar objCalendar = Calendar.getInstance();
        objCalendar.setTime(dateValue);//w w  w  . ja  v  a  2  s  . co  m
        int iYear = objCalendar.get(Calendar.YEAR);
        int iWeek = objCalendar.get(Calendar.WEEK_OF_YEAR);
        if (iWeek >= 10) {
            strWeekID = iYear + String.valueOf(iWeek);
        } else {
            strWeekID = iYear + "0" + iWeek;
        }
        return strWeekID;
    }
}

Related

  1. getWeekDayOfYear(Date date)
  2. getWeekDays(String _date, int _amount)
  3. getWeekDaysBetween(Date fromDate, Date toDate, int dayOfWeek)
  4. getWeekEnd(Date date, int w)
  5. getWeekFirstDay(Date weekday)
  6. getWeekNum(Date date)
  7. getWeekNumber(Date date)
  8. getWeekNumber(Date date, Integer day)
  9. getWeekNumberFromDate(Date date)