Java Day day2ThuesDay(Date date)

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

Description

day Thues Day

License

Apache License

Declaration

static String day2ThuesDay(Date date) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import java.util.TimeZone;

public class Main {
    static String day2ThuesDay(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
        calendar.setTime(date);/*from  www. jav a  2s  . c  o  m*/

        int week = calendar.get(Calendar.DAY_OF_WEEK);
        if (week == Calendar.MONDAY || week == Calendar.SUNDAY) {
            week += 7;
        }
        calendar.add(Calendar.DAY_OF_MONTH, -week);
        calendar.add(Calendar.DAY_OF_MONTH, Calendar.TUESDAY);
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
        return format.format(calendar.getTime());
    }
}

Related

  1. dateValue(Date d)
  2. day2Day(String startDate, String endDate, String format)
  3. dayDiff(Date date1, String date2)
  4. dayEnd(Date date)
  5. dayFillter(String text, String type)
  6. dayFillter(String text, String type)