public class DateCreation {
public static void main(String[] args) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
String format = sdf.format(date);
System.out.print("date is:"+format);
}
}
這是工作的罰款,並輸出爲:日期:2014年2月11日日期格式不適用於spring的服務類?
但是,當我在春天MVC的服務層使用相同的語法比它的結果: 日期爲:???? - ?? - ??
這是春天的代碼。有一個@Override函數,我已經使用它。
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
String format = sdf.format(date);
logger.info("current date is:"+format);
什麼可能是錯誤?
這聽起來沒有什麼彈簧對我來說。可能你在模式變量中有一個錯誤 – gerrytan
請告訴我們你是如何在Spring中使用它的。 –
@SotiriosDelimanolis我已經更新了 –