public interface Format
public Object format(Object data, String pattern) {
if (data instanceof Date) {
SimpleDateFormat sdf = null;
if (pattern == null) {
sdf = new SimpleDateFormat();
} else {
sdf = new SimpleDateFormat(pattern);
}
return sdf.format(data);
} else {
throw new RuntimeException("Arg Error:Type should be Date");
}
}
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
format(Object data,
String pattern) |
Copyright © 2015. All rights reserved.