根据时间的变化修改表名


package com.XX.utils;

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

/**
 * Created by apple on 2017/10/1.
 */
public class DateUtil {

    private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static String format(Date date) {
        return sdf.format(date);
    }

    public static Date getTimeByMinusHour(Date date, int n) {
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.MINUTE, -1*n);
        return cal.getTime();
    }


    public static String dateToStr(java.util.Date dateDate) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd");
        String dateString = formatter.format(dateDate);
        return dateString;
    }

    public static void main(String[] args) {

        Date date = new Date();
        String dateString = dateToStr(date);
        String talbe = "DD"+dateString;
        System.out.print(talbe);
    }
}


上一篇:物联网魅力新世界:互连设备的新商业模式


下一篇:《游戏大师Chris Crawford谈互动叙事》一1.6 时间的不连续性