2009-09-24

JSP DateTime assign to JavaScript DateTime

w3school JavaScript setTime() Method link / link cn


JSP code
< %
java.util.Date jdt1 = new java.util.Date(); //now

out.println("
jdt1= " + jdt1 ); // output to web page for check
% >


JavaScript code
< script language="JavaScript">
var jsdt1 = new Date() ;
jsdt1.setTime( < %=jdt1.getTime() % > ) // set from mSec

document.write("
jsdt1 = " + jsdt1 ) ; // output to web page for review
< /script>

沒有留言: