package com.sysu.admin.utils;

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

public class MySimpleDateFormat{
	
	
	private final static SimpleDateFormat formatDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	private final static SimpleDateFormat formatDate = new SimpleDateFormat("yyyy-MM-dd");
	
	public static String formatDateTime(Date date) {
		return formatDateTime.format(date);
	}
	
	public static String formatDate(Date date) {
		return formatDate.format(date);
	}
	
	public static Date parseDate(String source) {
		try {
			return formatDate.parse(source);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	public static Date parseDateTime(String source) {
		try {
			return formatDateTime.parse(source);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	

}
