日期:2014-05-17  浏览次数:20661 次

JSP页面怎么得到服务器时间啊放在JS里的。
<javascript>
...
if(confirm("您确定上传"+这里需要得到服务器的时间+"个月的库存数据?")){


我用<% java.util.date这样怎么老出错

------解决方案--------------------
直接用肯定报错啊。现在页面上方定义好变量,然后直接使用
<%
java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd");
java.text.SimpleDateFormat timeFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date currDate = new java.util.Date();
String currentDate = dateFormat.format(currDate);
String currentTime = timeFormat.format(currDate);
System.out.println(currentDate + "/当前日期");
System.out.println(currentTime + "/当前时间");
%>

if(confirm("您确定上传<%=currentDate%>个月的库存数据?")){