package com.edu.lingnan.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/*
* 时间工具类
*/
public class DateUtil {
public static String formatDate(Date date,String format){
String result="";
SimpleDateFormat sdf=new SimpleDateFormat(format);
if(date!=null){
result=sdf.format(date);
}
return result;
}
public static Date formatString(String str,String format) throws Exception{
SimpleDateFormat sdf=new SimpleDateFormat(format);
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/*
* 时间工具类
*/
public class DateUtil {
public static String formatDate(Date date,String format){
String result="";
SimpleDateFormat sdf=new SimpleDateFormat(format);
if(date!=null){
result=sdf.format(date);
}
return result;
}
public static Date formatString(String str,String format) throws Exception{
SimpleDateFormat sdf=new SimpleDateFormat(format);