package org.well.well.core.util;

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

/**
 * Created by Administrator on 2015/2/25.
 */
public class DateUtils {
    public static SimpleDateFormat sdf_day = new SimpleDateFormat("yyyy-MM-dd");
    public static SimpleDateFormat sdf_day_time = new SimpleDateFormat("yyyyMMddhhmmss");
    public static final SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public static final SimpleDateFormat sdf5 = new SimpleDateFormat("HH:mm:ss");
    public static final SimpleDateFormat sdf6 = new SimpleDateFormat("yyyyMMdd");

    public  static  String DateFormat(String dataString) {

        String strymd = dataString.substring(0, 8);
        String str1 = strymd.substring(0, 4) + "-" + strymd.substring(4, 6) + "-" + strymd.substring(6, 8) + " ";
        String strhms = dataString.substring(8);
        String str2 =strhms.substring(0,2)+":"+strhms.substring(2,4)+":"+strhms.substring(4,6);
        dataString =str1+str2;
        return dataString;
    }

    public static Date getSevenBeforeDate() throws ParseException {
        Calendar calendar=Calendar.getInstance();
        calendar.add(calendar.DATE,-7);
        Date sevenBeforDate=calendar.getTime();
        return sevenBeforDate;
    }
}
