private static final Time BEGIN = new Time(9, 0, 0);
private static final Time END = new Time(20, 0, 0);
构造函数Time已弃用,有没有办法修复这些声明?
答案 0 :(得分:2)
您现在可以像javadocs一样使用。
Time(long time)
使用毫秒时间值构造Time对象。
短搜索给了我这个:
Calendar cal = Calendar.getInstance();
// set Date portion to January 1, 1970
cal.set( cal.YEAR, 1970 );
cal.set( cal.MONTH, cal.JANUARY );
cal.set( cal.DATE, 1 );
cal.set( cal.MILLISECOND, 0 );
java.sql.Time jsqlT =
new java.sql.Time( cal.getTime().getTime() );