Skip to content

Commit e53a5dd

Browse files
committed
Update FieldUtils.java
1 parent 8043566 commit e53a5dd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/net/tsz/afinal/utils/FieldUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
* @created 2012-10-10
3838
*/
3939
public class FieldUtils {
40+
public static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
41+
4042
public static Method getFieldGetMethod(Class<?> clazz, Field f) {
4143
String fn = f.getName();
4244
Method m = null;
@@ -337,11 +339,10 @@ public static boolean isBaseDateType(Field field){
337339
clazz.isPrimitive();
338340
}
339341

340-
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
341-
private static Date stringToDateTime(String strDate) {
342+
public static Date stringToDateTime(String strDate) {
342343
if (strDate != null) {
343344
try {
344-
return sdf.parse(strDate);
345+
return SDF.parse(strDate);
345346
} catch (ParseException e) {
346347
e.printStackTrace();
347348
}

0 commit comments

Comments
 (0)