|
@@ -1,5 +1,7 @@
|
|
package com.steerinfo.dil.util;
|
|
package com.steerinfo.dil.util;
|
|
|
|
|
|
|
|
+import org.apache.commons.lang.time.FastDateFormat;
|
|
|
|
+
|
|
import java.io.File;
|
|
import java.io.File;
|
|
import java.io.FileWriter;
|
|
import java.io.FileWriter;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -10,8 +12,9 @@ import java.util.zip.CheckedOutputStream;
|
|
public class newFileTool {
|
|
public class newFileTool {
|
|
|
|
|
|
public static int newFile(String jsonString,String type) throws IOException {
|
|
public static int newFile(String jsonString,String type) throws IOException {
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
- String date = sdf.format(new Date());
|
|
|
|
|
|
+ //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ FastDateFormat format = FastDateFormat.getInstance("yyyy-MM-dd");
|
|
|
|
+ String date = format.format(new Date());
|
|
File file = new File("../log/" + date + "-" + type);
|
|
File file = new File("../log/" + date + "-" + type);
|
|
FileWriter fileWriter = new FileWriter(file,true);
|
|
FileWriter fileWriter = new FileWriter(file,true);
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
@@ -27,13 +30,4 @@ public class newFileTool {
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
- //public static void main(String[] args) {
|
|
|
|
- // //System.out.println(new Date().getDate());
|
|
|
|
- //
|
|
|
|
- // try {
|
|
|
|
- // newFile("我输入一个文件","计量");
|
|
|
|
- // } catch (IOException e) {
|
|
|
|
- // e.printStackTrace();
|
|
|
|
- // }
|
|
|
|
- //}
|
|
|
|
}
|
|
}
|