Android Timestamp Get getCurrentWeek(Timestamp t1)

Here you can find the source of getCurrentWeek(Timestamp t1)

Description

get Current Week

Declaration

public static int getCurrentWeek(Timestamp t1) 

Method Source Code

//package com.java2s;

import java.sql.Timestamp;

import java.util.Calendar;

import java.util.GregorianCalendar;

public class Main {
    public static int getCurrentWeek() {
        Calendar cal = Calendar.getInstance();
        return cal.get(Calendar.WEEK_OF_YEAR);
    }/*from w  w  w.  java 2 s .  co  m*/

    public static int getCurrentWeek(Calendar cal) {
        if (cal == null) {
            cal = Calendar.getInstance();
        }
        return cal.get(Calendar.WEEK_OF_YEAR);
    }

    public static int getCurrentWeek(Timestamp t1) {
        Calendar cal;
        if (t1 == null) {
            cal = Calendar.getInstance();
        } else {
            cal = new GregorianCalendar();
            cal.setTime(t1);
        }
        return cal.get(Calendar.WEEK_OF_YEAR);
    }
}

Related

  1. getCurrentMonth(Timestamp t1)
  2. getFirstOfMonth(Timestamp t1)
  3. getFirstOfYear(Timestamp t1)
  4. getFriendlyTimeStamp()
  5. getLastOfMonth(Timestamp t1)