在servlet中
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
birthday=sdf.parse(request.getParameter("birthday"));
在jsp中:
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String date=sdf.format(regUser.getBirthday());
本文介绍了在Servlet和JSP中如何使用SimpleDateFormat进行日期格式化的方法。通过实例展示了如何将字符串转换为日期对象以及如何将日期对象转换为指定格式的字符串。
在servlet中
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
birthday=sdf.parse(request.getParameter("birthday"));
在jsp中:
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String date=sdf.format(regUser.getBirthday());
2875
3534

被折叠的 条评论
为什么被折叠?