20f9850e1626001d19b3d5b2cbdf6b4e
来自「实训时做的物流系统」· 代码 · 共 48 行
TXT
48 行
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 {
private static SetDate instance;
public static SetDate getInstance(){
if (instance==null){
instance = new SetDate();
}
return instance;
}
public Date SetPrintDate(PrintDate prD){
Date date = new Date();
if(prD==null){
return date = null;
}else{
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)
//}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?