package com.zxbw.modulemain.uitls;

import com.umeng.commonsdk.debug.D;

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

/**
 * @author (wangXuewei)
 * @datetime 2022-06-27 15:43 GMT+8
 * @detail :
 */
public class TimeUtils {

    /**
     * 获取当前日期是星期几
     * @param date
     * @return
     */
    public static String getWeekOfDate(Date date) {
        String[] weekDays = { "日", "一", "二", "三", "四", "五", "六" };
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
        if (w < 0)
            w = 0;
        return "周"+weekDays[w];
    }

    public static Date getDate(int day){
        if(day==0){
            return new Date();
        }else{
            Date d = new Date();
            long myTime = (d.getTime() / 1000) + day * 24 * 60 * 60;
            d.setTime(myTime * 1000);
            return d;
        }
    }


}
