PublicManager.java 752 Bytes
Newer Older
licc's avatar
licc committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
package cn.wisenergy.service.Manager;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

/**
 * @author 86187
 * @ Description: 账户管理公共类
 * @ Author     : 86187
 * @ Date       : 2021/2/23 10:43
 */
@Component
@Slf4j
public class PublicManager {
    public boolean isThisMonth(Date time, String pattern) {
        Date date = new Date(time.getTime());
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        //参数时间
        String param = sdf.format(date);

        //当前时间
        String now = sdf.format(new Date());
        if (param.equals(now)) {
            return true;
        }
        return false;

    }
}