0
我對Spring MVC的工作了相當長的一段時間,碰上這個問題Spring MVC的夏令問題
我的應用程序時區設置爲New_York用下面的代碼:
public class ApplicationListenerBean implements ApplicationListener {
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof ContextRefreshedEvent) {
TimeZone.setDefault(TimeZone.getTimeZone("America/New_York"));
System.out.println("Eastern time zone");
}
}
}
接下來,我「M提交表單,並與代碼閱讀它:
@RequestMapping("/saveschedule")
@ResponseBody
public String saveSchedule(
@ModelAttribute CommonSchedule schedule, ModelMap map, HttpServletRequest request) {
System.out.println(">>>>>>>>>>>>>>>> " + schedule.getSendingTime());
System.out.println(new Date());
}
如果我選擇的時候,15:30:00,我得到的輸出 我得到以下的輸出:
>>>>>>>>>>>>>>>> Thu Jan 01 05:30:00 EST 1970
Mon Aug 26 06:20:01 EDT 2013
我想知道,爲什麼Spring MVC的表單提交獲得EST,而我的應用程序是EDT
謝謝馬特,你明白了,我會隨着時間發送日期 – Ashutosh