Java Day of Week getWeekOfYear(String date)

Here you can find the source of getWeekOfYear(String date)

Description

get Week Of Year

License

Open Source License

Declaration

public static String getWeekOfYear(String date) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {

    public static String getWeekOfYear(String date) {
        String[] tempYear = date.trim().split("-");
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.YEAR, Integer.valueOf(tempYear[0]));
        cal.set(Calendar.MONTH, (Integer.valueOf(tempYear[1]) - 1));
        cal.set(Calendar.DATE, Integer.valueOf(tempYear[2]));
        int week = cal.get(Calendar.WEEK_OF_YEAR);
        return String.valueOf(week);
    }//from w w w. j  av a 2s  .c om
}

Related

  1. getWeekOfTheYear(final Date dateOfYear)
  2. getWeekOfYear(Date d, Locale locale)
  3. getWeekOfYear(Date date)
  4. getWeekOfYear(Date date)
  5. getWeekOfYear(Date date)
  6. getWeeksBetweenDate(Date begin, Date end)
  7. getWeekStart(Date date)
  8. getWeekStart(Date date)
  9. getWeekStartDateBeforeCurrent(int weekNum, Date current)