将java.util.Date date转java.sql.Date 存入sql
package com.fs.utils;
public class DateUtils {
public static java.sql.Date changeDate(java.util.Date date){
if (date ==null){
throw new RuntimeException("date不能为空:"+date);
}
return new java.sql.Date(date.getTime());
}
}
//用如下测试
import com.fs.utils.DateUtils;
import java.util.Date;
public class test {
public static void main(String[] args) {
Date utilDate =new Date();
java.sql.Date sqlDate = Date
共有 0 条评论