dateformat.java

来自「生产管理系统 使用SSH」· Java 代码 · 共 25 行

JAVA
25
字号
package task.action;

import java.sql.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;
/*
 * liuu
 * 
 *
 */
public class DateFormat {
	//转化时间
	public static Date FormatDate(String datestring) throws Exception {
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		Date date = null;
		try {
			date = new Date(format.parse(datestring).getTime());
		} catch (ParseException e) {
			e.printStackTrace();
			throw new Exception();
		}
		return date;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?