Java Year Get getWeekOfYear(Date date)

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

Description

get Week Of Year

License

Apache License

Declaration

public static int getWeekOfYear(Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static int getWeekOfYear(Date date) {
        String weekOfYear = format(date, "ww");
        return Integer.parseInt(weekOfYear);
    }/*from   w w  w  . j av a  2  s  .  co m*/

    public static String format(Date date, String formatPattern) {
        // Assert.notNull(date);
        return new SimpleDateFormat(formatPattern).format(date);
    }
}

Related

  1. getThisYear()
  2. getThisYear()
  3. getThisYear()
  4. getTwoDigitYear()
  5. getTwoYearsBefore(int date)
  6. getWeekStartEndDate(int timeInfo, String yearInfo)
  7. getYear()
  8. getYear()
  9. getYear()