80c2087a590c001d1f9e8316f26add13
来自「实训时做的物流系统」· 代码 · 共 38 行
TXT
38 行
package com.lib.biz;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.lib.cls.InDate;
import com.lib.cls.PrintDate;
public class SetDate {
public static Date SetPrintDate(PrintDate prD){
Date date = new Date();
try {
date = new SimpleDateFormat("yyyy-MM-dd").parse(prD.getYear()+"-"+prD.getMonth()+"-"+prD.getDay());
} catch (Exception e) {
System.out.println("出版日期格式错误");
}
return date;
}
public Date SetInDate(InDate inD){
Date date = new Date();
try {
date = new SimpleDateFormat("yyyy-MM-dd").parse(inD.getYear()+"-"+inD.getMonth()+"-"+inD.getDay());
} catch (Exception e) {
System.out.println("出版日期格式错误");
}
return date;
}
public static void main(String[] args) {
PrintDate prid = new PrintDate();
prid.setDay("12");
prid.setMonth("02");
prid.setYear("2002");
Date date = SetPrintDate(prid);
System.out.println(date);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?