simpleDateFormat 不适用于 websphere
simpleDateFormatter not working on websphere
我正在 ubuntu 上开发 Java 1.7。
我的代码和功能运行良好。但是当我将它部署在 Websphere 上时 java.text.SimpleDateFormatter
不工作......
其显示解析 error.My websphere 环境有 linux 和 Java 1.4.2。如果有人知道这个问题,请帮助我。
这是我的代码
public static String formatDate(String commingDate){
String formatedDate = "00-00-00";
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
Date date = sdf.parse(commingDate);
formatedDate = sdf.format(date);
} catch (ParseException e) {
log.error(e);
}
return formatedDate;
}
SimpleDataFormat(String)
构造函数使用默认系统语言环境。您的 Websphere 服务器可能具有不同的默认语言环境,这会导致不同的行为。尝试明确指定语言环境:
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH);
参见 this 类似问题的答案。
我正在 ubuntu 上开发 Java 1.7。
我的代码和功能运行良好。但是当我将它部署在 Websphere 上时 java.text.SimpleDateFormatter
不工作......
其显示解析 error.My websphere 环境有 linux 和 Java 1.4.2。如果有人知道这个问题,请帮助我。
这是我的代码
public static String formatDate(String commingDate){
String formatedDate = "00-00-00";
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
Date date = sdf.parse(commingDate);
formatedDate = sdf.format(date);
} catch (ParseException e) {
log.error(e);
}
return formatedDate;
}
SimpleDataFormat(String)
构造函数使用默认系统语言环境。您的 Websphere 服务器可能具有不同的默认语言环境,这会导致不同的行为。尝试明确指定语言环境:
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH);
参见 this 类似问题的答案。