22 lines
617 B
Java
22 lines
617 B
Java
package com.engine.salary.transmethod;
|
|
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
|
|
public class TransMethod {
|
|
|
|
public static String timeToDate(String time) {
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
String format = "";
|
|
try {
|
|
Date parse = timeFormat.parse(time);
|
|
format = dateFormat.format(parse);
|
|
} catch (ParseException e) {
|
|
e.printStackTrace();
|
|
}
|
|
return format;
|
|
}
|
|
}
|