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